Skip to content

feat(banner): hide zsh install tip when plugin is already loaded#3100

Open
EmojiPati wants to merge 2 commits intotailcallhq:mainfrom
EmojiPati:feat/suppress-zsh-tip-when-plugin-loaded
Open

feat(banner): hide zsh install tip when plugin is already loaded#3100
EmojiPati wants to merge 2 commits intotailcallhq:mainfrom
EmojiPati:feat/suppress-zsh-tip-when-plugin-loaded

Conversation

@EmojiPati
Copy link
Copy Markdown
Contributor

Summary

When `forge` is launched from a shell that has already sourced the zsh plugin, the `TIP: For the best experience, use our zsh plugin!` banner is noise — the user already has it configured. Detect that at runtime and skip the encouragement block.

Context

The generated zsh plugin and theme scripts already write `_FORGE_PLUGIN_LOADED` and `_FORGE_THEME_LOADED` timestamps so `forge zsh doctor` can introspect them (`crates/forge_main/src/zsh/plugin.rs:47`, `crates/forge_main/src/zsh/plugin.rs:58`). However the assignments were not `export`ed, so the markers stayed shell-local and were invisible to any child `forge` process. That made runtime detection from inside forge itself impossible.

Changes

  • `crates/forge_main/src/zsh/plugin.rs`: prefix both `_FORGE_PLUGIN_LOADED` and `_FORGE_THEME_LOADED` assignments with `export` so they propagate into the environment inherited by invoked forge processes.
  • `crates/forge_main/src/banner.rs`: suppress the zsh encouragement block in `display()` when `_FORGE_PLUGIN_LOADED` is set. Adds `is_zsh_plugin_loaded()` modeled after `is_vscode_terminal()` in `crates/forge_main/src/vscode.rs:9-16` — a small `std::env`-backed check with an `EnvGuard`-based test covering both set and unset cases.

Behavior

Scenario Tip shown?
Plugin not installed Yes (unchanged)
Plugin installed and `.zshrc` sourced No (new)
CLI / non-interactive mode (`-p`) No (unchanged)

Testing

```bash
cargo test -p forge_main --lib banner::
cargo test -p forge_main --lib zsh::plugin::
cargo clippy -p forge_main --lib --tests -- -D warnings
```

@github-actions github-actions Bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature Brand new functionality, features, pages, workflows, endpoints, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant