Repository navigation
fix(hooks): the Hot Reload hook works with BSD sed on macOS - #195
Merged
Merged
Conversation
hot-reload-edit.sh used two GNU-only sed constructs that BSD sed (macOS)
accepts without an error but handles differently:
- `\|` alternation in a basic regex: the edited file's path never matched,
so the hook exited 0 with no output after every edit. Now `sed -E` with
`(xaml|cs)`.
- `N` on the last line in json_escape: BSD sed drops the pattern space, so
a one-line verdict ("edit to '...': applied") came out empty. Now `$!N`.
Found by the AX evaluation of the plugin (round 1, 2026-10-16): in all 10
full-stack runs on macOS every hook event returned empty output.
Test-Hooks.ps1 runs the hook against canned input and a stand-in DevServer
CLI (no CLI, applied, compile failure, rude edit, other file types), and
CI runs it on ubuntu-latest and macos-latest; the old script fails it on
macOS and passes it on Linux.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B4tF6WULD6Bus9fnPC6hXx
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.
GitHub Issue (If applicable): n/a (internal, found by the AX evaluation of the plugin)
PR Type
What is the current behavior?
On macOS,
hooks/hot-reload-edit.shnever says anything. It uses two GNU-onlysedconstructs that BSDsedaccepts without an error but handles differently:\|alternation in a basic regex (\.\(xaml\|cs\)). BSDsedhas no alternation there, so the edited file's path never matches and the hook exits 0 with no output after every.xaml/.csedit.json_escapejoins lines with:a;N;$!ba. On the last line, BSDsed'sNdrops the pattern space instead of printing it, so any one-line string comes out empty. The Hot Reload verdict is always one line (head -1), so even with (1) fixed, every status message would read "Hot Reload The running app…" with the verdict missing. (1) hid this bug.In the AX evaluation (Claude Code on macOS, plugin 471ef25), every hook event in all 10 full-stack runs returned
"output": "". CI runs only onubuntu-latest, where GNUsedhandles both constructs, so it never caught either one.What is the new behavior?
sed -En 's/.*"file_path" *: *"([^"]*\.(xaml|cs))".*/\1/p'.json_escape:$!Ninstead ofN, the portable idiom..github/scripts/Test-Hooks.ps1runs the hook against canned hook input and a stand-in DevServer CLI. It covers six cases: no CLI (reminder), XAML file, applied, compile failure (decision: blockwith the diagnostics), rude edit, and other file types (no output). It also checks that the output is valid JSON.validate-plugin.ymlgets ahooksjob that runs it onubuntu-latestandmacos-latest.Verified on macOS (Darwin 27, BSD sed):
End to end against a running app (Uno.Sdk 7.0.0-dev.81,
uno-devserver7.0.0-dev.2354, desktop):Hot Reload edit to 'Smoke/Presentation/MainPage.xaml': applied (server op #1 Success in 1.7s, … 1 element(s) replaced), anduno_app_find_elementssaw the new text.{"decision":"block", … error CS1525: Invalid expression term ';'}.In a rerun of the evaluation's repair scenario (5 runs), the hook now returns output after every edit (5/5, was 0/5).
PR Checklist
Additional Information
Not in this PR, for follow-up:
uno-devserverCLI with theappcommand. Only 7.0 dev builds have it: 6.7.24 and 6.7.135 (latest stable) answerUnknown command 'app', so the hook falls back to the reminder, with no warning. The plugin doesn't name a minimum version.Edit|Write|MultiEditmatcher misses files the agent writes with Bash heredocs, which happened in 4 of 5 full-stack runs of the feature scenario.🤖 Generated with Claude Code
https://claude.ai/code/session_01B4tF6WULD6Bus9fnPC6hXx