diff --git a/docs/superpowers/contracts/app-icons-register-code-apps-2026-11-19.json b/docs/superpowers/contracts/app-icons-register-code-apps-2026-11-19.json new file mode 100644 index 00000000..0377612f --- /dev/null +++ b/docs/superpowers/contracts/app-icons-register-code-apps-2026-11-19.json @@ -0,0 +1,15 @@ +{ + "title": "Register kartka, leetcode and todoimpl in app_icons", + "objective": "The app_icons generator can regenerate the family icons kartka, leetcode-guard/app and todoImplementer/app already ship, with the same glyph shape, accent and field.", + "acceptance_criteria": [ + "apps.get_app returns kartka, leetcode and todoimpl with glyph, icon_name and linux flag taken from disk facts", + "Each renders the standard 1024px svg+png layer set into a temp dir without error; linux-flagged ones render the hicolor sizes", + "Regenerated icon.png matches the shipped one side by side", + "python_pkg/app_icons stays at 100% branch coverage" + ], + "out_of_scope": [ + "Writing into any sibling repo", + "betting_sim's dead registry path and the shared track-bars glyph" + ], + "verifier": "python -m pytest -q python_pkg/app_icons --cov=python_pkg.app_icons --cov-branch" +} diff --git a/docs/superpowers/evidence/app-icons-register-code-apps-2026-11-19.json b/docs/superpowers/evidence/app-icons-register-code-apps-2026-11-19.json new file mode 100644 index 00000000..0a6abb6f --- /dev/null +++ b/docs/superpowers/evidence/app-icons-register-code-apps-2026-11-19.json @@ -0,0 +1,38 @@ +{ + "intent": "Register kartka, leetcode-guard/app and todoImplementer/app in python_pkg/app_icons so the generator can regenerate the family icons they already ship, with no visible change.", + "scope": [ + "python_pkg/app_icons/_glyph_art_code.py (new), glyphs.py, _apps_more.py, labels.py, tests/test_registry_code_apps.py (new)", + "Non-goal: no sibling repo is touched or regenerated; betting_sim and the shared track-bars glyph are untouched" + ], + "changes": [ + "Three glyphs ported verbatim from each app's shipped assets/icon/icon_foreground.svg: document-split (kartka), code-brackets (leetcode), screen-tick-play (todoimpl); literal accent replaced by the accent marker", + "Registry entries and launcher labels Kartka / LeetGuard / TodoImpl (taken from each AndroidManifest android:label)", + "Linux flags: kartka=True (desktop/install_desktop_entry.sh installs a hicolor set from desktop/icons, built with --linux-out); leetcode=True (tool/install_desktop.sh writes leetcode-guard-app.desktop, so icon_name=leetcode-guard-app; it currently points Icon= at assets/icon/icon.png); todoimpl=False (no linux/ target or desktop entry in the Flutter app; the desktop board is the separate web/ TS app)" + ], + "verification": [ + { + "command": "python -m pytest -q python_pkg/app_icons --cov=python_pkg.app_icons --cov-branch", + "result": "pass", + "evidence": "144 passed; Total coverage: 100.00%. New tests were red first (12 failed, KeyError on the unregistered keys)" + }, + { + "command": "regenerate the three apps into a temp dir with generate.write_assets on a repo-replaced AppIcon, then paste shipped vs new icon.png side by side", + "result": "pass", + "evidence": "Every new icon.png is 1024x1024 (shipped leetcode/todoimpl were 640x640). Side-by-side sheet shows the same glyph shape, gold #B8862E accent and charcoal field for all three" + }, + { + "command": "python -m python_pkg.app_icons list; git -C ~/src/{kartka,leetcode-guard,todoImplementer} status --short", + "result": "pass", + "evidence": "list shows kartka document-split +linux, leetcode code-brackets +linux, todoimpl screen-tick-play; sibling repos show only their pre-existing untracked .claude/ and tools/errors/" + } + ], + "risks": [ + "Follow-up: leetcode-guard/app and todoImplementer/app ship 640px icon.png (drift); regenerating there will write the standard 1024px set", + "Follow-up, not changed: betting_sim's registry path ~/src/betting-sim/app does not exist", + "Follow-up, not changed: kuhylog and betting_sim share the track-bars glyph" + ], + "rollback": [ + "git revert the commit", + "python -m pytest python_pkg/app_icons passes and list no longer shows the three keys" + ] +} diff --git a/docs/superpowers/evidence/deps-bump-anthropic-ruff-2026-10-10.json b/docs/superpowers/evidence/deps-bump-anthropic-ruff-2026-10-10.json deleted file mode 100644 index 6140a990..00000000 --- a/docs/superpowers/evidence/deps-bump-anthropic-ruff-2026-10-10.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "intent": "main goes green again: 'Pre-commit checks' and 'dependency freshness' failed on 2026-10-09 only because pins fell behind new upstream releases.", - "scope": [ - "meta/requirements.txt, meta/requirements-test.txt", - "Non-goal: pre-commit hook revs (not checked by the freshness gate)" - ], - "changes": [ - "anthropic 1.12.1 -> 1.13.0 (both files), pyupgrade 3.21.2 -> 3.22.0, reorder-python-imports 3.17.0 -> 3.18.0", - "black 26.10.0 -> 26.10.1, pipdeptree 4.2.5 -> 4.2.6, ruff 0.16.10 -> 0.17.0, selenium 4.50.0 -> 4.51.0 (went stale since the red run)" - ], - "verification": [ - { - "command": "scripts/check_dependency_freshness.sh meta/requirements.txt meta/requirements-test.txt", - "result": "pass", - "evidence": "exit 0 (only the existing typescript transitive exception listed)" - }, - { - "command": "pip install --dry-run -r meta/requirements.txt -r meta/requirements-test.txt", - "result": "pass", - "evidence": "resolves, exit 0" - }, - { - "command": "pytest python_pkg/code_tutor (fresh venv from meta/requirements-test.txt, anthropic 1.13.0)", - "result": "pass", - "evidence": "217 passed" - } - ], - "risks": [ - "ruff 0.17.0 from requirements.txt may flag new rules when run outside pre-commit (pre-commit pins its own ruff rev)" - ], - "rollback": [ - "git revert this commit", - "Re-run scripts/check_dependency_freshness.sh: it will report the old pins as behind again" - ] -} diff --git a/python_pkg/app_icons/_apps_more.py b/python_pkg/app_icons/_apps_more.py index d06fbb48..77944fcd 100644 --- a/python_pkg/app_icons/_apps_more.py +++ b/python_pkg/app_icons/_apps_more.py @@ -52,4 +52,34 @@ MORE_APPS: Final[tuple[AppIcon, ...]] = ( # Android only: no linux/ target and no desktop entry. linux=False, ), + AppIcon( + key="kartka", + repo=_HOME / "src/kartka", + accent="#B8862E", + glyph="document-split", + icon_name="kartka", + # desktop/install_desktop_entry.sh installs desktop/icons// + # kartka.png into hicolor; its header names `--linux-out desktop/icons`. + linux=True, + ), + AppIcon( + key="leetcode", + repo=_HOME / "src/leetcode-guard/app", + accent="#B8862E", + glyph="code-brackets", + icon_name="leetcode-guard-app", + # tool/install_desktop.sh writes leetcode-guard-app.desktop. It points + # Icon= at assets/icon/icon.png today, not at a hicolor set. + linux=True, + ), + AppIcon( + key="todoimpl", + repo=_HOME / "src/todoImplementer/app", + accent="#B8862E", + glyph="screen-tick-play", + icon_name="todoimpl", + # Android only: no linux/ target and no desktop entry. The desktop + # board is the separate web/ TypeScript app, not this Flutter build. + linux=False, + ), ) diff --git a/python_pkg/app_icons/_glyph_art_code.py b/python_pkg/app_icons/_glyph_art_code.py new file mode 100644 index 00000000..07f90334 --- /dev/null +++ b/python_pkg/app_icons/_glyph_art_code.py @@ -0,0 +1,49 @@ +"""Glyphs of apps that shipped a family icon before they were registered here. + +kartka, leetcode-guard and todoImplementer each drew their icon by hand in the +family style and committed it with no registry entry, so the generator could +not regenerate them. Each fragment below is ported verbatim from that app's +``assets/icon/icon_foreground.svg``, with only the hand-applied transform and +stroke width dropped (the renderer refits every fragment) and the literal +accent replaced by the marker, so regenerating changes nothing visible. +""" + +from __future__ import annotations + +# A document with a folded corner over a split lower panel -- kartka, a +# character sheet: the sheet itself. From ~/src/kartka/assets/icon. +# +# Geometry: page x=320..704, y=256..768 with the corner cut at (576,256) -> +# (704,384); the fold is a filled triangle. The lower panel starts at y=544 +# and splits at x=464, so the smallest cell is 144x224 on the centreline, +# far clear of MIN_NEGATIVE_SPACE=36. +_DOCUMENT_SPLIT = """\ + + + + """ + +# ```` code brackets -- leetcode-guard, which gates on solving a LeetCode +# problem: the code being written. From ~/src/leetcode-guard/app/assets/icon. +# +# Geometry: chevrons from x=208 / x=816 to their tips at x=352 / x=672, height +# y=344..680, with the slash x=472..552 between them; 120px between a chevron +# and the slash at mid-height. +_CODE_BRACKETS = """\ + + + """ + +# A screen holding a tick and a play triangle -- todoImplementer, which drives +# backlog items through to done: the item run and ticked off. From +# ~/src/todoImplementer/app/assets/icon. +# +# Geometry: rounded screen x=208..816, y=272..752, corner r=72; tick +# (345,525)->(410,590)->(515,465); filled play triangle x=615..712, +# y=430..610. The tick and the triangle sit 100px apart. +_SCREEN_TICK_PLAY = """\ + + + """ diff --git a/python_pkg/app_icons/glyphs.py b/python_pkg/app_icons/glyphs.py index 9df97513..aa76551f 100644 --- a/python_pkg/app_icons/glyphs.py +++ b/python_pkg/app_icons/glyphs.py @@ -29,6 +29,11 @@ from python_pkg.app_icons._glyph_art import ( _SHIELD_CUTLERY, _STORAGE_BOX, ) +from python_pkg.app_icons._glyph_art_code import ( + _CODE_BRACKETS, + _DOCUMENT_SPLIT, + _SCREEN_TICK_PLAY, +) from python_pkg.app_icons._glyph_art_extra import ( _CAMERA, _HEADPHONES, @@ -112,6 +117,17 @@ GLYPHS: Final[dict[str, Glyph]] = { _PROMPT_BUBBLE, ), Glyph("camera", "Camera body with a viewfinder hump and a lens", _CAMERA), + Glyph( + "document-split", + "Page with a filled folded corner over a split lower panel", + _DOCUMENT_SPLIT, + ), + Glyph("code-brackets", "Angle brackets around a slash: ", _CODE_BRACKETS), + Glyph( + "screen-tick-play", + "Rounded screen holding a tick and a filled play triangle", + _SCREEN_TICK_PLAY, + ), ) } diff --git a/python_pkg/app_icons/labels.py b/python_pkg/app_icons/labels.py index 38e7bd43..1f8b9101 100644 --- a/python_pkg/app_icons/labels.py +++ b/python_pkg/app_icons/labels.py @@ -49,6 +49,9 @@ LABELS: Final[dict[str, str]] = { "tunedeck": "TuneDeck", "sufler": "Sufler", "macro_cam": "MacroCam", + "kartka": "Kartka", + "leetcode": "LeetGuard", + "todoimpl": "TodoImpl", } diff --git a/python_pkg/app_icons/tests/test_registry_code_apps.py b/python_pkg/app_icons/tests/test_registry_code_apps.py new file mode 100644 index 00000000..e9532dc8 --- /dev/null +++ b/python_pkg/app_icons/tests/test_registry_code_apps.py @@ -0,0 +1,70 @@ +"""Tests for the kartka, leetcode and todoimpl registry entries. + +Those three apps shipped family icons before they were registered here; the +glyphs are ports of the shipped ``icon_foreground.svg`` fragments, so these +tests render each one through the real pipeline into ``tmp_path`` (never the +app's own repo) and check the standard-size set comes out. +""" + +from __future__ import annotations + +import dataclasses +from typing import TYPE_CHECKING + +from PIL import Image +import pytest + +from python_pkg.app_icons import apps, generate, glyphs, labels, style + +if TYPE_CHECKING: + from pathlib import Path + +# key -> (glyph, icon_name, linux, repo path under ~) +_EXPECTED: dict[str, tuple[str, str, bool, str]] = { + "kartka": ("document-split", "kartka", True, "src/kartka"), + "leetcode": ("code-brackets", "leetcode-guard-app", True, "src/leetcode-guard/app"), + "todoimpl": ("screen-tick-play", "todoimpl", False, "src/todoImplementer/app"), +} + + +@pytest.mark.parametrize("key", sorted(_EXPECTED)) +class TestCodeAppEntries: + def test_entry_matches_disk_facts(self, key: str) -> None: + glyph, icon_name, linux, repo = _EXPECTED[key] + app = apps.get_app(key) + assert app.glyph == glyph + assert app.icon_name == icon_name + assert app.linux is linux + assert app.repo == apps.Path.home() / repo + assert glyphs.get_glyph(glyph).name == glyph + + def test_label_is_valid(self, key: str) -> None: + assert labels.label_problems(apps.get_app(key).label) == [] + + def test_renders_standard_size_set(self, key: str, tmp_path: Path) -> None: + app = dataclasses.replace(apps.get_app(key), repo=tmp_path / key) + written = generate.write_assets(app) + assert sorted(path.name for path in written) == sorted( + f"{stem}.{ext}" + for stem in ("icon", "icon_foreground", "icon_monochrome") + for ext in ("svg", "png") + ) + for path in written: + if path.suffix == ".png": + with Image.open(path) as image: + assert image.size == (style.CANVAS, style.CANVAS) + + +@pytest.mark.parametrize("key", ["kartka", "leetcode"]) +def test_renders_linux_set(key: str, tmp_path: Path) -> None: + icons = generate.write_linux_icons(apps.get_app(key), tmp_path) + assert len(icons) == len(style.LINUX_ICON_SIZES) + for size, path in zip(style.LINUX_ICON_SIZES, icons, strict=True): + with Image.open(path) as image: + assert image.size == (size, size) + + +def test_filled_parts_take_the_accent_marker() -> None: + """Folded corner and play triangle recolour on the monochrome layer.""" + for name in ("document-split", "screen-tick-play"): + assert f'fill="{style.ACCENT_MARKER}"' in glyphs.get_glyph(name).body