feat: Add post-generation hooks support#106
Merged
connerohnesorge merged 1 commit intomainfrom Oct 14, 2025
Merged
Conversation
Add support for running bash commands after protobuf code generation completes.
- Add hooks.postGeneration option for bash commands to run after all generation
- Add hooks.onFailure option to control behavior when hooks fail (continue/stop)
- Set environment variables for hook context (BUFRNIX_ROOT, enabled languages, etc.)
- Integrate with existing debug logging system
- Maintain backward compatibility (hooks are optional)
Usage example:
hooks = {
postGeneration = ''
echo "Running post-generation tasks..."
find . -name "*.pb.go" -exec gofmt -w {} +
cd gen/go && go mod tidy
'';
onFailure = "continue";
};
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
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.
Summary
Add support for running bash commands after protobuf code generation completes. This feature allows users to automate post-generation tasks like formatting, building packages, running validation, etc.
Changes
Configuration Schema (
src/lib/bufrnix-options.nix)hooks.postGenerationoption for bash commands to run after all generationhooks.onFailureoption to control behavior when hooks fail (continue/stop)Core Implementation (
src/lib/mkBufrnix.nix)BUFRNIX_ROOT: Project root directoryBUFRNIX_ENABLED_LANGUAGES: List of enabled languagesBUFRNIX_DEBUG_ENABLE: Debug flagBUFRNIX_DEBUG_VERBOSITY: Debug verbosity levelUsage Example
Testing
Benefits
This feature enables users to automate common post-generation tasks like code formatting, package building, validation, and other custom workflows as part of their declarative Bufrnix configuration.
🤖 Generated with Claude Code