Repository navigation
Rewrite lifecycle.py for legibility, and make every hook return a string - #20
Merged
Merged
Conversation
…tions-1 # Conflicts: # examples/ask.py # examples/terminal.py # examples/translate.py # examples/voice_commands.py
lifecycle.py for legibility, and make every hook return a string
nigelgilbert
marked this pull request as ready for review
November 22, 2026 20:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
lifecycle.pyis rewritten to read top to bottom, following a short set of Python style rules that are now in the repo. The branch also carries #23, which changes what a hook must return.For existing hook files
Every hook now returns a string. Returning
None, or nothing, used to mean "leave it as it was". Now it fails like any other hook failure:on_transcribed,on_cleaned,on_sent): addreturn tto change nothing.""still stops the dictation.on_done: also returnst. The return is not used, but it is checked.on_error: returneto pass to the nexton_errorhook, or to the default message when none is left. A string is still the message and""still means no message. A hook that returnsNoneis skipped and its failure goes inerrors.txt.What changed
docs/pythonic.mdholds seven Python style rules, and a newCLAUDE.mdpoints agents at them.lifecycle.py: helpers now come first, names are clearer, every function has a docstring, and long expressions are split into one step per line.on_doneandon_erroreach get their own function, sofireandreporthave no special cases.Checks
In
sidecar/:pytest103 passed,pyright0 errors,ruff checkandruff format --checkclean.