feat(terminal): add directory selection when opening provider terminal#1429
feat(terminal): add directory selection when opening provider terminal#1429010egg wants to merge 8 commits intofarion1231:mainfrom
Conversation
This allows users to choose the starting directory (cwd) when launching an isolated Claude Code terminal. If cancelled, it defaults to the home directory. fix(i18n): fix translation parameter mismatch in stream check errors
|
Hi, I owe you an apology for the long silence. As the sole maintainer of this project, I've been overwhelmed and fell behind on reviews — but that's on me, not on you. Your contribution matters and I will review this PR. If it needs a rebase, just let me know or I can handle it. Thank you for your time and patience. |
…penclaw) - Remove claude-only restriction on onOpenTerminal button in frontend - Refactor launch_terminal_with_env to accept app_type and build app-specific scripts: - Claude: existing --settings config file approach - Others: export env vars directly and run the respective CLI (codex/gemini/opencode/openclaw) - Update macOS, Linux, Windows terminal launch functions to accept payload string instead of hardcoded claude command
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ccf5b4906
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| std::process::id(), | ||
| sanitize_tmux_name(cwd) | ||
| )); | ||
| write_claude_config(&config_file, env_vars)?; |
There was a problem hiding this comment.
Clean up Claude batch config files after pane startup
Each Claude pane writes a claude_batch_*.json file with provider env secrets, but the generated pane command never deletes that file after launch. Unlike the single-terminal path (which uses trap cleanup), batch sessions leave these credential-bearing temp files in /tmp indefinitely, creating an avoidable local secret-leak surface and filesystem buildup. Add cleanup on shell exit for each pane config file.
Useful? React with 👍 / 👎.
| let escaped = v.replace('\\', "\\\\").replace('"', "\\\""); | ||
| format!("export {k}=\"{escaped}\"") | ||
| }) |
There was a problem hiding this comment.
Use Windows env syntax for non-Claude terminal payloads
For non-Claude apps, the payload is built with Unix export statements, then later embedded unchanged into a .bat launcher on Windows. cmd.exe does not support export, so provider env variables are not applied, which means Codex/Gemini terminals can launch with missing or wrong credentials. Generate a Windows-specific payload (e.g., set KEY=...) before writing the batch script.
Useful? React with 👍 / 👎.
| let config_path = config_file.to_string_lossy(); | ||
|
|
||
| let cd_command = if let Some(dir) = cwd { | ||
| format!("cd \"{}\"", dir) |
There was a problem hiding this comment.
Escape cwd before interpolating it into launcher scripts
The selected working directory is inserted directly into cd "{dir}" without escaping. A valid path containing a double quote can break the generated shell script and may inject unintended shell tokens, so terminal launch can fail or execute unexpected commands for such directories. Quote/escape cwd safely (or pass it as an argument) before script generation.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ccf5b4906
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let config_path = config_file.to_string_lossy(); | ||
|
|
||
| let cd_command = if let Some(dir) = cwd { | ||
| format!("cd \"{}\"", dir) |
There was a problem hiding this comment.
Escape selected cwd before writing shell launch script
The chosen directory is interpolated directly into a shell line (cd "{dir}") without escaping. On macOS/Linux, a valid folder name containing characters like " or command substitution syntax (for example $(...)) can break the cd command or execute unintended shell code when the terminal starts. Because cwd comes from user-selected filesystem paths, this is a real runtime bug; pass cwd as an argument or apply robust shell escaping before embedding it in script content.
Useful? React with 👍 / 👎.
| <Button | ||
| variant="ghost" | ||
| size="icon" | ||
| onClick={() => setIsBatchTerminalOpen(true)} | ||
| aria-label={t("provider.batchTerminal.button", "批量启动")} | ||
| title={t("provider.batchTerminal.button", "批量启动")} |
There was a problem hiding this comment.
Gate batch-launch button on unsupported Windows backend
This UI action is shown unconditionally, but the backend path for Windows always returns an error (批量 tmux 启动暂不支持 Windows). That means Windows users can open and submit the batch-launch dialog, but the operation can never succeed. The feature should be hidden/disabled on Windows (or implemented server-side) to avoid an always-failing workflow.
Useful? React with 👍 / 👎.

This allows users to choose the starting directory (cwd) when launching an isolated Claude Code terminal. If cancelled, it defaults to the home directory.
fix(i18n): fix translation parameter mismatch in stream check errors