Inject commands: PATH shims in anvil shell#5
Merged
Conversation
`anvil shell <pkg>` now materialises the package's `commands:` aliases as PATH shims inside a fresh tempdir, prepends it to $PATH, and exports `$ANVIL_COMMAND_DIR`. Closes the asymmetry where `anvil run <pkg> -- foo` knew the alias map but a shell opened via `anvil shell <pkg>` did not. - POSIX (Linux/macOS): `#!/usr/bin/env bash` + `exec <cmd> "$@"`, chmod 755. Works for bash/zsh/sh/fish and any shell that resolves external commands through the kernel (including pwsh on Unix). - Windows: `.cmd` wrapper resolvable through PATHEXT from cmd.exe, PowerShell, and pwsh. Opt-outs: `--env-only`, `ANVIL_DISABLE_COMMAND_SHIMS=1`, `shell.inject_commands: false` in config. `--no-sweep` skips the orphan cleanup for debugging. Orphaned shim tempdirs are swept on entry via a configurable `shell.orphan_ttl` (default 1h) so SIGKILL'd shells never leak more than one tempdir. Ref #4 https://claude.ai/code/session_01V6KvHd4mVcM4XRwy4sNVSq
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.
anvil shell <pkg>now materialises the package'scommands:aliases asPATH shims inside a fresh tempdir, prepends it to $PATH, and exports
$ANVIL_COMMAND_DIR. Closes the asymmetry whereanvil run <pkg> -- fooknew the alias map but a shell opened via
anvil shell <pkg>did not.#!/usr/bin/env bash+exec <cmd> "$@", chmod 755.Works for bash/zsh/sh/fish and any shell that resolves external commands
through the kernel (including pwsh on Unix).
.cmdwrapper resolvable through PATHEXT from cmd.exe,PowerShell, and pwsh.
Opt-outs:
--env-only,ANVIL_DISABLE_COMMAND_SHIMS=1,shell.inject_commands: falsein config.--no-sweepskips the orphancleanup for debugging.
Orphaned shim tempdirs are swept on entry via a configurable
shell.orphan_ttl(default 1h) so SIGKILL'd shells never leak more thanone tempdir.
Ref #4
https://claude.ai/code/session_01V6KvHd4mVcM4XRwy4sNVSq