Skip to content

feat(terminal): add directory selection when opening provider terminal#1429

Open
010egg wants to merge 8 commits intofarion1231:mainfrom
010egg:main
Open

feat(terminal): add directory selection when opening provider terminal#1429
010egg wants to merge 8 commits intofarion1231:mainfrom
010egg:main

Conversation

@010egg
Copy link
Copy Markdown

@010egg 010egg commented Mar 11, 2026

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

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
@010egg
Copy link
Copy Markdown
Author

010egg commented Mar 11, 2026

image

@farion1231
Copy link
Copy Markdown
Owner

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.

xiaoqin added 3 commits April 12, 2026 19:35
…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
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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)?;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +1199 to +1201
let escaped = v.replace('\\', "\\\\").replace('"', "\\\"");
format!("export {k}=\"{escaped}\"")
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@farion1231
Copy link
Copy Markdown
Owner

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment thread src/App.tsx
Comment on lines +1036 to +1041
<Button
variant="ghost"
size="icon"
onClick={() => setIsBatchTerminalOpen(true)}
aria-label={t("provider.batchTerminal.button", "批量启动")}
title={t("provider.batchTerminal.button", "批量启动")}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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