From 7c44dc2b68d17613111d136bdf3f108e096ead03 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sat, 28 Nov 2026 15:01:01 -0700 Subject: [PATCH] Screen-look check, tuning round: name screens, windows, PDFs, print and footers as screen work Every term is now matched as a whole word (the boundaries used to bind only the first and last term), so 'build' no longer counts as 'ui'. Eight terms are added for screens, windows, UI, onboarding, PDFs, printable matter, footers and terminals; write, generate and produce count as making. The four look groups are one compiled expression. Train 0.95 (38 of 40), held 0.96 (22 of 23), every real row right. --- sisi/hooks.py | 14 +++++++------- tests/test_core.py | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/sisi/hooks.py b/sisi/hooks.py index 0b01940..a910002 100644 --- a/sisi/hooks.py +++ b/sisi/hooks.py @@ -152,19 +152,19 @@ def prompt(p): # A brief states no look when it makes something (MAKING), names two or more of SCREEN and has neither a `Look:` / `Design system:` line nor three # of the four GROUPS (type, colour, spacing, grid). Each entry is a regular expression, tried against the lowercase brief. -SCREEN = ("layouts?", "screenshots?", "viewports?", "phone[- ]widths?", "responsive", "stylesheets?", "css", "dark mode", "light and dark", - "typefaces?", "toolbars?", "sidebars?", "modals?", "dialog box(?:es)?", "cards?", "panels?", "charts?", "buttons?", "headlines?", "wraps", "scroll\\w*") -_SCREEN = re.compile(r"\b(" + r")|(".join(SCREEN) + r")\b") -MAKING = re.compile(r"\b(?:build\w*|creat\w*|mak(?:e|es|ing)\b|(?:re)?design\w*|restyle\w*|adds?\b|adding\b|lay(?:s|ing)? out|implement\w*)") -GROUPS = tuple(re.compile(p) for p in (r"fonts?|typefaces?|typography|type scale|helvetica|arial|roboto|georgia|garamond|times new roman|system-ui|sans-serif|segoe ui|sf pro|\binter\b", - r"#[0-9a-f]{3,8}\b|palettes?|colou?r schemes?", r"padding|margins?|\bgaps?\b|spacing|radius", r"\bgrids?\b|columns?|breakpoints?")) +SCREEN = ("layouts?", "screens?", "screenshots?", "windows?", "viewports?", "phone[- ]widths?", "responsive", "stylesheets?", "css", "dark mode", "light and dark", + "typefaces?", "toolbars?", "sidebars?", "modals?", "dialog box(?:es)?", "cards?", "panels?", "charts?", "buttons?", "headlines?", "wraps", "scroll\\w*", + "ui", "onboarding", "pdfs?", r"print(?:able|er|ing|ed)", "footer", "terminal") +_SCREEN = re.compile(r"\b(?:(" + r")|(".join(SCREEN) + r"))\b") +MAKING = re.compile(r"\b(?:build\w*|creat\w*|mak(?:e|es|ing)\b|(?:re)?design\w*|restyle\w*|adds?\b|adding\b|lay(?:s|ing)? out|implement\w*|writ(?:e|es|ing)\b|generat(?:e|es|ing)\b|produc(?:e|es|ing)\b)") +GROUPS = re.compile(r"((?:fonts?|typefaces?|typography|type scale|helvetica|arial|roboto|georgia|garamond|times new roman|system-ui|sans-serif|segoe ui|sf pro|\binter\b))|((?:#[0-9a-f]{3,8}\b|palettes?|colou?r schemes?))|((?:padding|margins?|\bgaps?\b|spacing|radius))|((?:\bgrids?\b|columns?|breakpoints?))") LOOK_LINE = re.compile(r"(?im)^\W{0,6}(?:look|design system)\s*:") def screen_brief_without_look(text): """True when a brief asks for something the person will look at and states no look for it. Anything that is not text is False.""" t = text.lower() if isinstance(text, str) else "" - return bool(MAKING.search(t)) and len({m.lastindex for m in _SCREEN.finditer(t)}) >= 2 and not LOOK_LINE.search(t) and sum(bool(g.search(t)) for g in GROUPS) < 3 + return bool(MAKING.search(t)) and len({m.lastindex for m in _SCREEN.finditer(t)}) >= 2 and not LOOK_LINE.search(t) and len({m.lastindex for m in GROUPS.finditer(t)}) < 3 def watch(p): diff --git a/tests/test_core.py b/tests/test_core.py index 9d8b1b8..6c95717 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1968,6 +1968,8 @@ cli.main(["tick"]) self.assertFalse(f(self.PAGE + "Type: Inter at 14/16/20. Spacing: 8px padding, 12px gaps. Grid: two columns above 900px.")) # three of four groups self.assertTrue(f(self.PAGE + "Type: Inter at 14/16/20. Grid: two columns above 900px.")) # two groups are not a look self.assertFalse(f(self.SERVER)) # "page" and "browser" alone are not screen work + self.assertFalse(f("Write a build guide: how the suite builds, what it prints and how long a window it needs")) # terms are whole words + self.assertTrue(f("Add PDF output for invoices: a customer prints it on A4, with a payment footer on every page.")) # paper a person reads self.assertFalse(f("Review the settings page: at phone width the toolbar overlaps the sidebar and the headline wraps. " "Report findings only.")) # looks, never makes for bad in ("", None, 12, {"prompt": self.PAGE}, [self.PAGE]):