Configurable environment variables per workspace/worktree #404
knowsuchagency
started this conversation in
Ideas
Replies: 1 comment 1 reply
|
I've also noticed that the environment variables passed via --env are available in the first workspace pane, but not in any additional panes. My usage case is also "Tools driving herdr can inject per-task context into the pane at creation.". I've got a tool that automatically creates tmux sessions with a specific environment, and it would be great to replace with creating herdr workspaces. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
idea / problem
Shells spawned for a workspace/worktree only inherit the herdr daemon's environment. There's no way to scope env vars to a workspace or worktree, so anything env-based has to be typed into the shell after creation (which races shell startup and any interactive prompt) or baked into global shell rc.
requested change
Let
workspace.createandworktree.createaccept anenvmap, applied to the environment of shells spawned in that workspace/worktree. CLI: a repeatable--env KEY=VALUE.Socket API:
{"method":"worktree.create","params":{"workspace_id":"1","branch":"feat/x","env":{"MISE_TRUSTED_CONFIG_PATHS":"/home/me/wt/x","DEPLOY_ENV":"staging"}}}CLI:
why you (well, I) want this
MISE_TRUSTED_CONFIG_PATHS=<worktree>means mise never shows its "trust this config?" prompt — that prompt otherwise blocks the shell and eats the first characters of any command sent right after creation. (direnv etc. similar.)DEPLOY_ENV=staging, an API base URL, a scoped token,RUST_LOG, … set before the first prompt, no rc edits.Related to #394 (setup script per space) but distinct: a setup script runs commands; this just sets the environment at spawn — it avoids the typed-command race and covers cases that aren't "run a command" (and the two compose, since env is available to a setup script too).
Happy to implement if there's interest.
All reactions