Skip to content

Execute project-local quick actions within an interactive shell to inherit environment variables #27

Description

@orzFly

Currently, when defining a quick action in .herdr-plus/quick-actions/run.toml:

name = "Run"
command = "cargo run"

It appears that herdr-plus executes the command without inheriting the environment variables of the current terminal session.

I rely on direnv to manage my development toolchains, meaning I do not have tools like cargo installed globally. My shell uses a direnv hook to automatically load the project-local PATH when I enter the directory. However, when invoking the quick action via herdr-plus, the command fails because it does not have access to this context-aware environment.

Proposed Solution:
Would it be possible to spawn a real, interactive shell to execute these quick action commands? Similar to how herdr restores agents on startup, injecting the command into an actual shell session would ensure that all shell hooks (like direnv) and environment variables are properly loaded before execution.

Current Workaround:
I can temporarily bypass this by explicitly prepending the environment manager to the command:

name = "Run"
command = "direnv exec {{.WorkDir}} cargo run"

However, this is far from ideal. It forces me to hardcode my local, environment-specific setup (direnv) into a project-level configuration file. This pollutes the shared config and exposes local development details to all other potential herdr-plus users of the project, who might be using completely different environment managers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions