diff --git a/.claude/skills/ui-ux-pro-max/scripts/search.py b/.claude/skills/ui-ux-pro-max/scripts/search.py index 07be642..5038aa8 100644 --- a/.claude/skills/ui-ux-pro-max/scripts/search.py +++ b/.claude/skills/ui-ux-pro-max/scripts/search.py @@ -120,6 +120,12 @@ if __name__ == "__main__": # Design system takes priority if args.design_system: + if args.stack: + print( + f"note: --stack {args.stack} is ignored in --design-system mode; " + "run a separate --stack query for stack-specific guidelines", + file=sys.stderr, + ) result = generate_design_system( args.query, args.project_name, diff --git a/.claude/skills/ui-ux-pro-max/scripts/tests/test_design_system_stack.py b/.claude/skills/ui-ux-pro-max/scripts/tests/test_design_system_stack.py new file mode 100644 index 0000000..50f0080 --- /dev/null +++ b/.claude/skills/ui-ux-pro-max/scripts/tests/test_design_system_stack.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Regression tests for the dropped --stack flag in --design-system mode (issue #484). + +`search.py "" --design-system --stack nextjs` used to exit successfully +without any indication that the stack was never applied, so a caller following +SKILL.md's "never assume a stack" guidance could believe stack guidance was +part of the generated design system. The combination must stay valid, but it +must say that --stack was ignored. + +Stdlib-only (unittest, not pytest) to match test_core.py -- this project ships +with zero external dependencies. + +Run with: + python -m unittest discover -s scripts/tests -v +or directly: + python scripts/tests/test_design_system_stack.py +""" + +import subprocess +import sys +import unittest +from pathlib import Path + +SCRIPTS_DIR = Path(__file__).resolve().parent.parent +SEARCH = SCRIPTS_DIR / "search.py" + + +class TestStackFlagWithDesignSystem(unittest.TestCase): + def run_search(self, *args): + # The child forces UTF-8 on its streams (search.py), so decode as UTF-8 + # regardless of the parent's locale on Windows. + return subprocess.run( + [sys.executable, str(SEARCH), *map(str, args)], + capture_output=True, + text=True, + encoding="utf-8", + errors="replace", + check=False, + ) + + def test_design_system_with_stack_succeeds_and_says_stack_is_ignored(self): + proc = self.run_search("platform engineer dashboard", "--design-system", "--stack", "nextjs") + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertIn("--stack", proc.stderr) + self.assertIn("ignored", proc.stderr.lower()) + + def test_design_system_without_stack_stays_quiet(self): + proc = self.run_search("platform engineer dashboard", "--design-system") + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertNotIn("ignored", proc.stderr.lower()) + + def test_stack_search_alone_never_warns(self): + proc = self.run_search("dashboard table density", "--stack", "nextjs") + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertNotIn("ignored", proc.stderr.lower()) + + +if __name__ == "__main__": + unittest.main(verbosity=2) diff --git a/cli/assets/scripts/search.py b/cli/assets/scripts/search.py index 07be642..5038aa8 100644 --- a/cli/assets/scripts/search.py +++ b/cli/assets/scripts/search.py @@ -120,6 +120,12 @@ if __name__ == "__main__": # Design system takes priority if args.design_system: + if args.stack: + print( + f"note: --stack {args.stack} is ignored in --design-system mode; " + "run a separate --stack query for stack-specific guidelines", + file=sys.stderr, + ) result = generate_design_system( args.query, args.project_name, diff --git a/cli/assets/scripts/tests/test_design_system_stack.py b/cli/assets/scripts/tests/test_design_system_stack.py new file mode 100644 index 0000000..50f0080 --- /dev/null +++ b/cli/assets/scripts/tests/test_design_system_stack.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Regression tests for the dropped --stack flag in --design-system mode (issue #484). + +`search.py "" --design-system --stack nextjs` used to exit successfully +without any indication that the stack was never applied, so a caller following +SKILL.md's "never assume a stack" guidance could believe stack guidance was +part of the generated design system. The combination must stay valid, but it +must say that --stack was ignored. + +Stdlib-only (unittest, not pytest) to match test_core.py -- this project ships +with zero external dependencies. + +Run with: + python -m unittest discover -s scripts/tests -v +or directly: + python scripts/tests/test_design_system_stack.py +""" + +import subprocess +import sys +import unittest +from pathlib import Path + +SCRIPTS_DIR = Path(__file__).resolve().parent.parent +SEARCH = SCRIPTS_DIR / "search.py" + + +class TestStackFlagWithDesignSystem(unittest.TestCase): + def run_search(self, *args): + # The child forces UTF-8 on its streams (search.py), so decode as UTF-8 + # regardless of the parent's locale on Windows. + return subprocess.run( + [sys.executable, str(SEARCH), *map(str, args)], + capture_output=True, + text=True, + encoding="utf-8", + errors="replace", + check=False, + ) + + def test_design_system_with_stack_succeeds_and_says_stack_is_ignored(self): + proc = self.run_search("platform engineer dashboard", "--design-system", "--stack", "nextjs") + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertIn("--stack", proc.stderr) + self.assertIn("ignored", proc.stderr.lower()) + + def test_design_system_without_stack_stays_quiet(self): + proc = self.run_search("platform engineer dashboard", "--design-system") + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertNotIn("ignored", proc.stderr.lower()) + + def test_stack_search_alone_never_warns(self): + proc = self.run_search("dashboard table density", "--stack", "nextjs") + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertNotIn("ignored", proc.stderr.lower()) + + +if __name__ == "__main__": + unittest.main(verbosity=2) diff --git a/src/ui-ux-pro-max/scripts/search.py b/src/ui-ux-pro-max/scripts/search.py index 07be642..5038aa8 100644 --- a/src/ui-ux-pro-max/scripts/search.py +++ b/src/ui-ux-pro-max/scripts/search.py @@ -120,6 +120,12 @@ if __name__ == "__main__": # Design system takes priority if args.design_system: + if args.stack: + print( + f"note: --stack {args.stack} is ignored in --design-system mode; " + "run a separate --stack query for stack-specific guidelines", + file=sys.stderr, + ) result = generate_design_system( args.query, args.project_name, diff --git a/src/ui-ux-pro-max/scripts/tests/test_design_system_stack.py b/src/ui-ux-pro-max/scripts/tests/test_design_system_stack.py new file mode 100644 index 0000000..50f0080 --- /dev/null +++ b/src/ui-ux-pro-max/scripts/tests/test_design_system_stack.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Regression tests for the dropped --stack flag in --design-system mode (issue #484). + +`search.py "" --design-system --stack nextjs` used to exit successfully +without any indication that the stack was never applied, so a caller following +SKILL.md's "never assume a stack" guidance could believe stack guidance was +part of the generated design system. The combination must stay valid, but it +must say that --stack was ignored. + +Stdlib-only (unittest, not pytest) to match test_core.py -- this project ships +with zero external dependencies. + +Run with: + python -m unittest discover -s scripts/tests -v +or directly: + python scripts/tests/test_design_system_stack.py +""" + +import subprocess +import sys +import unittest +from pathlib import Path + +SCRIPTS_DIR = Path(__file__).resolve().parent.parent +SEARCH = SCRIPTS_DIR / "search.py" + + +class TestStackFlagWithDesignSystem(unittest.TestCase): + def run_search(self, *args): + # The child forces UTF-8 on its streams (search.py), so decode as UTF-8 + # regardless of the parent's locale on Windows. + return subprocess.run( + [sys.executable, str(SEARCH), *map(str, args)], + capture_output=True, + text=True, + encoding="utf-8", + errors="replace", + check=False, + ) + + def test_design_system_with_stack_succeeds_and_says_stack_is_ignored(self): + proc = self.run_search("platform engineer dashboard", "--design-system", "--stack", "nextjs") + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertIn("--stack", proc.stderr) + self.assertIn("ignored", proc.stderr.lower()) + + def test_design_system_without_stack_stays_quiet(self): + proc = self.run_search("platform engineer dashboard", "--design-system") + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertNotIn("ignored", proc.stderr.lower()) + + def test_stack_search_alone_never_warns(self): + proc = self.run_search("dashboard table density", "--stack", "nextjs") + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertNotIn("ignored", proc.stderr.lower()) + + +if __name__ == "__main__": + unittest.main(verbosity=2)