Skip to content

feat(hooks): polyglot hook wrapper for cross-platform compatibility#86

Open
dean0x wants to merge 1 commit intomainfrom
feat/polyglot-hook-wrapper
Open

feat(hooks): polyglot hook wrapper for cross-platform compatibility#86
dean0x wants to merge 1 commit intomainfrom
feat/polyglot-hook-wrapper

Conversation

@dean0x
Copy link
Owner

@dean0x dean0x commented Mar 6, 2026

Summary

  • Adds polyglot run-hook wrapper that works as both Windows batch and Unix bash
  • All hook registrations now use run-hook <name> instead of direct .sh paths
  • Replaces set -euo pipefail with set -e in all 5 hook scripts for MSYS/MinGW compatibility
  • Skips chmod on Windows in installer

Changes

File Change
scripts/hooks/run-hook NEW — polyglot wrapper
scripts/hooks/*.sh (5 files) set -euo pipefailset -e
src/cli/commands/ambient.ts Hook command uses run-hook ambient-prompt
src/cli/commands/memory.ts Hook commands use run-hook prefix
src/cli/utils/installer.ts Platform-aware chmod (skip on Win32)
tests/ambient.test.ts Updated marker assertions
tests/memory.test.ts Updated marker assertions

Backward Compatibility

Existing installs with old-style .sh hook commands continue working because includes() checks match both ambient-prompt.sh and run-hook ambient-prompt. Old hooks remain functional until users --disable && --enable or re-run devflow init.

Test plan

  • npm run build passes
  • npm test — all 178 tests pass
  • run-hook session-start-memory correctly dispatches to .sh script
  • Old .sh marker strings still match via includes() backward compat

Closes #80
Part of #78

Adds a polyglot `run-hook` wrapper that works as both Windows batch and
Unix bash. All hook registrations now go through `run-hook <name>` instead
of calling `.sh` files directly.

Changes:
- scripts/hooks/run-hook: new polyglot wrapper (batch + bash)
- 5 hook scripts: replace `set -euo pipefail` with `set -e` (MSYS compat)
- ambient.ts/memory.ts: hook commands use `run-hook` prefix
- installer.ts: skip chmod on Windows
- Tests updated for new command format

Backward compatible: existing installs with old .sh paths still match via
`includes()` checks and continue working until re-enabled.

Closes #80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(hooks): polyglot hook wrapper for cross-platform compatibility

1 participant