Convert bash hooks to cross-platform Python modules #163
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