feat(hooks): polyglot hook wrapper for cross-platform compatibility#86
Open
feat(hooks): polyglot hook wrapper for cross-platform compatibility#86
Conversation
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
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
run-hookwrapper that works as both Windows batch and Unix bashrun-hook <name>instead of direct.shpathsset -euo pipefailwithset -ein all 5 hook scripts for MSYS/MinGW compatibilitychmodon Windows in installerChanges
scripts/hooks/run-hookscripts/hooks/*.sh(5 files)set -euo pipefail→set -esrc/cli/commands/ambient.tsrun-hook ambient-promptsrc/cli/commands/memory.tsrun-hookprefixsrc/cli/utils/installer.tstests/ambient.test.tstests/memory.test.tsBackward Compatibility
Existing installs with old-style
.shhook commands continue working becauseincludes()checks match bothambient-prompt.shandrun-hook ambient-prompt. Old hooks remain functional until users--disable && --enableor re-rundevflow init.Test plan
npm run buildpassesnpm test— all 178 tests passrun-hook session-start-memorycorrectly dispatches to.shscript.shmarker strings still match viaincludes()backward compatCloses #80
Part of #78