Skip to content

feat(starship): name the direnv environment in the prompt - #88

Open
mauroporras wants to merge 3 commits into
mainfrom
claude/zsh-prompt-env-indicator-xs9hgq
Open

mauroporras wants to merge 3 commits into
mainfrom
claude/zsh-prompt-env-indicator-xs9hgq

Conversation

@mauroporras

Copy link
Copy Markdown
Owner

A shell wired to production is indistinguishable from one wired to a
scratch database until after the command runs. Read PROJECT_ENV, which
direnv exports on the way into a directory and drops on the way out, and
render it as its own prompt segment.

Two custom modules rather than one env_var module because the styling has
to depend on the value: env_var renders every environment identically,
which defeats the point. The when conditions are exhaustive and mutually
exclusive, so exactly one ever renders, and both run sh builtins only
(~1ms per prompt, well inside command_timeout).

Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01QFcPixS6WQDbkFXPo2Uhx2

A shell wired to production is indistinguishable from one wired to a
scratch database until after the command runs. Read PROJECT_ENV, which
direnv exports on the way into a directory and drops on the way out, and
render it as its own prompt segment.

Two custom modules rather than one env_var module because the styling has
to depend on the value: env_var renders every environment identically,
which defeats the point. The when conditions are exhaustive and mutually
exclusive, so exactly one ever renders, and both run sh builtins only
(~1ms per prompt, well inside command_timeout).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFcPixS6WQDbkFXPo2Uhx2
Gives the prompt's environment indicator something to read in the
development/production example shells, and documents the contract at the
place someone copies from.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFcPixS6WQDbkFXPo2Uhx2
Covers what the segment means, where PROJECT_ENV comes from, and why the
variable isn't named ENVIRONMENT or APP_ENV.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFcPixS6WQDbkFXPo2Uhx2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants