Long-horizon execution — loops, planning, splits, hooks — step 8 of 10
Write pick_hook_lifecycle(action) that takes an action dict and
returns the appropriate hook lifecycle name as a string.
The action dict has a kind field. Map kinds to lifecycles:
bash→"pre"(block destructive commands BEFORE they run)edit→"post"(run tsc / lint AFTER the edit)file_write→"post"(run formatter AFTER the write)commit→"pre"(run tests BEFORE the commit)- any other / unknown kind →
"none"
Two actions run for you. Expected output:
bash → pre
edit → post
⌘↵ runs the editor.read, then continue.
Write pick_hook_lifecycle(action) that takes an action dict and
returns the appropriate hook lifecycle name as a string.
The action dict has a kind field. Map kinds to lifecycles:
bash→"pre"(block destructive commands BEFORE they run)edit→"post"(run tsc / lint AFTER the edit)file_write→"post"(run formatter AFTER the write)commit→"pre"(run tests BEFORE the commit)- any other / unknown kind →
"none"
Two actions run for you. Expected output:
bash → pre
edit → post
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.