Manage named routing scenes.
(args: list[str])
| 1802 | print(f" Status: {status}") |
| 1803 | |
| 1804 | def _cmd_scene(args: list[str]) -> None: |
| 1805 | """Manage named routing scenes.""" |
| 1806 | if not args: |
| 1807 | print("Usage: uncommon-route scene <action>", file=sys.stderr) |
| 1808 | print(" Actions: list, add, remove, show", file=sys.stderr) |
| 1809 | sys.exit(1) |
| 1810 | |
| 1811 | from uncommon_route.scene_store import SceneConfig, SceneStore |
| 1812 | |
| 1813 | store = SceneStore() |
| 1814 | action = args[0].lower() |
| 1815 | |
| 1816 | if action == "list": |
| 1817 | scenes = store.list() |
| 1818 | if not scenes: |
| 1819 | print("No scenes configured.") |
| 1820 | print(" Add one: uncommon-route scene add intimate anthropic/claude-opus-4.6 --hard-pin") |
| 1821 | return |
| 1822 | for scene in scenes: |
| 1823 | pin_label = " [hard-pin]" if scene.hard_pin else " [adaptive]" |
| 1824 | desc = f" ({scene.description})" if scene.description else "" |
| 1825 | fallback_str = f" -> {', '.join(scene.fallback)}" if scene.fallback else "" |
| 1826 | print(f" {scene.name}: {scene.primary}{fallback_str}{pin_label}{desc}") |
| 1827 | |
| 1828 | elif action == "add": |
| 1829 | if len(args) < 3: |
| 1830 | print( |
| 1831 | "Usage: uncommon-route scene add <name> <primary> [fallback...] " |
| 1832 | "[--hard-pin] [--description 'desc']", |
| 1833 | file=sys.stderr, |
| 1834 | ) |
| 1835 | sys.exit(1) |
| 1836 | name = args[1] |
| 1837 | primary = args[2] |
| 1838 | fallback = [] |
| 1839 | hard_pin = False |
| 1840 | description = "" |
| 1841 | i = 3 |
| 1842 | while i < len(args): |
| 1843 | if args[i] == "--hard-pin": |
| 1844 | hard_pin = True |
| 1845 | i += 1 |
| 1846 | elif args[i] == "--description" and i + 1 < len(args): |
| 1847 | description = args[i + 1] |
| 1848 | i += 2 |
| 1849 | elif args[i] == "--fallback": |
| 1850 | i += 1 |
| 1851 | while i < len(args) and not args[i].startswith("--"): |
| 1852 | fallback.append(args[i]) |
| 1853 | i += 1 |
| 1854 | elif not args[i].startswith("--"): |
| 1855 | fallback.append(args[i]) |
| 1856 | i += 1 |
| 1857 | else: |
| 1858 | i += 1 |
| 1859 | |
| 1860 | scene = SceneConfig( |
| 1861 | name=name, |
nothing calls this directly
no test coverage detected