Convert bash hooks to cross-platform Python modules#163
Open
Conversation
Replace bash hook scripts with Python module implementations that work on Windows, macOS, and Linux without requiring bash. This is a general improvement extracted from the Windows support work. Changes: - Add capture_prompt.py, user_prompt_submit.py, hook_entry.py modules - Update global_hooks.yml to use module references instead of .sh scripts - Update hooks_syncer.py to use forward slashes for cross-platform paths - Remove deprecated bash scripts (capture_prompt_work_tree.sh, user_prompt_submit.sh) - Remove make_new_job.sh bash permission (no longer needed) - Add cross-platform hooks tests https://claude.ai/code/session_011mvvEHLPHc8o9w6NwayWC6
c3a9483 to
0cffca3
Compare
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
Converts the DeepWork hook system from bash scripts to cross-platform Python modules, enabling hooks to work on Windows, macOS, and Linux without requiring bash or shell interpreters.
Key Changes
Removed bash hook scripts:
user_prompt_submit.sh→deepwork.hooks.user_prompt_submitPython modulecapture_prompt_work_tree.sh→deepwork.hooks.capture_promptPython module.deepwork/jobs/deepwork_rules/hooks/andsrc/deepwork/standard_jobs/deepwork_rules/hooks/Added Python hook implementations:
src/deepwork/hooks/user_prompt_submit.py: Captures work tree state on prompt submissionsrc/deepwork/hooks/capture_prompt.py: Git work tree state capture utility (cross-platform equivalent of bash script)src/deepwork/hooks/hook_entry.py: Cross-platform hook entry point for direct Python invocationUpdated hook configuration:
global_hooks.ymlnow references Python modules instead of shell scriptsUpdated adapter permissions:
Bash(./.deepwork/jobs/deepwork_jobs/make_new_job.sh:*)permission (no longer needed)Updated documentation:
doc/architecture.md: Updated hook system architecture diagrams and descriptionsCHANGELOG.md: Documented the conversion and cross-platform benefitssrc/deepwork/hooks/__init__.py: Updated module docstring with new hook system descriptionImplementation Details
deepwork hook <name>CLI command, which works on all platforms regardless of installation method (pip, pipx, uv, Windows EXE, etc.)Testing
tests/unit/test_cross_platform_hooks.pywith tests for:capture_work_tree()functionalityuser_prompt_submithook behavior