feat(adapters): Bash/Zsh native-location and POSIX-safe sh adapters (#16) - #19
Merged
Merged
Conversation
) - Implement dedicated native caller-location adapter for Bash using BASH_LINENO - Implement dedicated native caller-location adapter for Zsh using funcfiletrace - Implement isolated POSIX-safe compatibility adapter for sh with minimal rewriting - Use adapter-private event file side-channel for framed records to keep redirections and pipelines unpolluted - Preserve runtime.args across shell adapters while filtering out inline -c - Remove obsolete shared shell wrapper and legacy shell error parsing - Add full test coverage across bash, zsh, and sh adapters
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.
Closes #16.
Why
Replace the shared shell wrapper with separate strategies tailored to each runtime's capabilities:
shuses an isolated POSIX-safe compatibility adapter without Bash/Zsh extensions.What
lua/itchy/adapters/bash.lua): Native caller-location instrumentation viaBASH_LINENO[0]in a managed launcher; unchanged user source sourced in-place; framed records emitted to an adapter-private event file side-channel; preserves redirections, pipelines, andprintf -v.lua/itchy/adapters/zsh.lua): Native caller-location instrumentation viafuncfiletrace[1]fromzsh/parameter; preserves builtins, redirections, and pipelines.shadapter (lua/itchy/adapters/sh.lua): Dedicated POSIX-safe compatibility adapter; conservative source transformation limited to actualecho/printfcommands; line count preserved 1:1; native stderr diagnostics mapped back through header line offset.lua/itchy/adapters/shell_common.lua): Private event file record decoding, stream folding to deduplicate delegated builtin output, native stderr diagnostic parsing, launcher templating, andruntime.argspreservation.lua/itchy/wrappers/shell.lua, updatedlua/itchy/wrappers/init.lua, and removed shell-specific diagnostic parsing fromlua/itchy/adapters/legacy.lua.sh(covering echo, printf, functions, control flow, redirections, pipelines,command/builtin,printf -v, syntax errors, command-not-found, visual selections, POSIX safety regex gate, and customruntime.argspreservation).Verification
Full test suite: 219 cases, 0 fails.