ADR-0006: Alfred Script Filter compatibility¶
Status: Accepted
Context¶
Alfred's Script Filter format (a script prints {"items": [...]}) is the
best-known way to extend a launcher, and many scripts exist that do not depend
on macOS. Asking those authors to learn a new format would waste that work. At
the same time, Alfred's format has features (variables, rerun, workflow
objects, arbitrary URL schemes) that would widen what a script result can do.
Decision¶
- A one-shot script plugin may declare
format = "alfred"(crates/sevak-plugins/src/script/alfred.rs). Sevak reads the script's JSON and maps it onto its ownResultItems; nothing in the Alfred document reaches the platform layer unmapped. - The mapping is deliberately conservative.
argbecomes an action by shape:http://,https://andmailto:open in the browser or mail client, an existing absolute path (or~/...) opens with its default program, and anything else is copied. Other schemes are copied, never opened, because the platform layer only opens web and mail links (ADR-0003). icon.pathis resolved inside the plugin folder.modsbecome secondary actions; Alfred modifier combinations (andctrlandfn) that have no Sevak key are listed in the action panel only.- Supported keys:
title,subtitle,uid,arg,autocomplete,valid,type,icon.path,mods(arg,subtitle,valid,variables),variables(item and top level, in workflows),quicklookurl(a file path previews the file, a web address is shown as a link and never fetched),text.copy,text.largetype,match(only when a workflow node lets Sevak filter), top-levelskipknowledge,cache(secondsclamped to 5..86 400,loosereload; in memory, 64 queries per filter) andrerun(0.1..5 s; it stops when the query changes or the launcher hides). - Accepted and ignored, never an error:
strictmods,icon.resize,iconresize,icon.type. Unknown keys are ignored. - Everything a script asks for stays inside Sevak's closed action vocabulary:
quicklookurlonly chooses what the local preview pane shows,cacheandrerunonly decide when the script runs again (the same approved command), and none of them opens a URL scheme or fetches anything. - Compatible scripts are still script plugins: the user approves the command before it first runs (ADR-0005).
- Sevak's own JSON protocol stays the primary, documented format; Alfred support is a bridge, not the model for new features.
Consequences¶
- Existing cross-platform Alfred scripts run without changes; macOS-only ones
(AppleScript,
osascript) do not. - Scripts that rely on
variablespassing between workflow objects, or on opening custom URL schemes, behave differently from Alfred. - A second input format has to be parsed defensively, because it comes from a
script Sevak does not control. The parser is the reason
alfred.rsexists as a separate, tested module.