test(quickshell): inventory external commands
9943a988665838650794934f269d772ca30f490d
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
- Parent 1: 9904fafdc834
bugabingas dorkfiles
9943a988665838650794934f269d772ca30f490d
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
+61 / −6 text lines
+3 / −0 text lines
- external executable dependencies are inventoried and unknown direct process-launch commands fail the audit.external_commands=awk,brightnessctl,cliphist,cut,grep,head,hyprctl,hyprlock,hyprpicker,hyprshot,iwctl,loginctl,makoctl,nu,playerctl,satty,sed,sh,systemctl,upower,uptime,uwsm,wezterm,wl-copy,wpctlexternal_commands=awk,brightnessctl,cliphist,cut,grep,head,hyprctl,hyprlock,hyprpicker,hyprshot,iwctl,loginctl,makoctl,nu,playerctl,satty,sed,sh,systemctl,upower,uptime,uwsm,wezterm,wl-copy,wpctl+58 / −6 text lines
code_by_file = {} code_by_file[rel] = code# These are known transitional bridges, not hidden dependencies. Keep them# visible so they cannot be mistaken for final parity.all_code = "\n".join(p.read_text() for p in qml_files)for command in ("cliphist", "makoctl"): if command in all_code: warnings.append(f"transitional external bridge still present: {command}")# Keep executable dependencies explicit. Quickshell can replace companion UI,# but system/session CLIs still exist at command boundaries until later parity# phases remove or validate them. Unknown commands fail so new dependencies do# not sneak into the self-contained config.all_code = "\n".join(code_by_file.values())external_commands = { "awk": "approved parser in shell snippet", "brightnessctl": "approved brightness backend", "cliphist": "transitional clipboard storage bridge", "cut": "approved parser in shell snippet", "grep": "approved parser in shell snippet", "head": "approved parser in shell snippet", "hyprctl": "approved Hyprland control until bind migration", "hyprlock": "approved session lock backend", "hyprpicker": "approved color picker backend", "hyprshot": "approved screenshot backend", "iwctl": "approved iwd status backend", "loginctl": "approved session lock helper", "makoctl": "transitional notification bridge", "nu": "approved terminal TUI shell", "playerctl": "approved MPRIS action helper", "satty": "approved screenshot annotation backend", "sed": "approved parser in shell snippet", "sh": "approved shell boundary for existing command pipelines", "systemctl": "approved gated power/session backend", "upower": "approved battery TUI backend", "uptime": "approved status backend", "uwsm": "approved session app launcher", "wezterm": "approved terminal launcher", "wl-copy": "approved clipboard output backend", "wpctl": "approved PipeWire action helper",}detected = []for command, reason in sorted(external_commands.items()): if re.search(rf"(?<![A-Za-z0-9_-]){re.escape(command)}(?![A-Za-z0-9_-])", all_code): detected.append((command, reason)) if reason.startswith("transitional"): warnings.append(f"transitional external bridge still present: {command}")# This catches direct process-launch array heads that are not in the approved# inventory. Shell snippets launched through `sh -c` are inventoried by known# command names above; they remain explicit but are too free-form for a safe# generic parser.launch_patterns = ( r'\.exec\(\["([A-Za-z0-9_.+-]+)"', r'detached\(\["([A-Za-z0-9_.+-]+)"', r'\.command\s*=\s*\["([A-Za-z0-9_.+-]+)"',)for pattern in launch_patterns: for match in re.finditer(pattern, all_code): candidate = match.group(1) if candidate not in external_commands: errors.append(f"unknown direct external command {candidate!r}; add it to audit inventory with a reason or remove it")