Repository navigation
shell 执行加固:PS flags + 跨平台 prompt 借鉴 + Unix 登录 shell env - #5
Merged
Merged
Conversation
…ning
Adopting two well-worn practices from opencode and Claude Code's shell layers:
- Invoke PowerShell with -NonInteractive -NoLogo (in addition to
-NoProfile). The agent has no console to answer a prompt, so a command
that blocks on one would hang until timeout; -NonInteractive fails fast
instead. -NoLogo drops the 5.1 startup banner from captured output.
- os_hint now teaches the PowerShell 5.1 run-if-previous-succeeded form
`cmd1; if ($?) { cmd2 }`, since a bare `;` (unlike `&&`) runs the next
command unconditionally. pwsh 7 keeps the `&&`/`||` guidance.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Borrowed from opencode's and Claude Code's per-shell prompt contracts: - A: the exploration guideline now carves out file reading — use the read tool for a known file's contents, not `cat` (Unix) / `Get-Content` (Windows). Listing/searching still go through the shell. - B: the Windows shell description teaches the call operator for paths with spaces — `& "C:\Program Files\app\tool.exe" args` — a common PowerShell footgun where a bare quoted path is treated as a string. - B': the redirection guideline notes that PowerShell 5.1's `>`/`Out-File` default to UTF-16-with-BOM, so `-Encoding utf8` is needed when another tool must read the file. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Two Unix borrows from opencode and Claude Code's shell layers. #1 login-shell env hydration (fixes "command not found"): A GUI launched from the Finder/dock inherits a minimal PATH (/usr/bin:/bin), so `bash -c` never sees tools the user installed via their shell rc (nvm/pyenv/conda, Homebrew, npm-global) — which is why `future ...` came back "command not found". At startup, before any thread or the tokio runtime (set_var is only sound single-threaded), run `$SHELL -l -i -c` once to dump `env` between markers, then take PATH from it and additively merge any vars the launcher didn't already set. 5s timeout + spawn-failure fallback keep a hanging rc from blocking startup. No-op on Windows (GUI processes already get the full registry PATH). Mirrors what VS Code / fix-path do. Verified: starting with PATH= /usr/bin:/bin, the agent logs "hydrated PATH from login shell (/bin/zsh)". #2 Unix shell resolution: shell_invocation no longer hardcodes "bash". It honors $SHELL when it is bash/zsh (both POSIX-compatible with the `( … ) 2>&1` wrapper), else probes bash then zsh on PATH, else falls back to sh. Never fish/nu — their syntax would break the wrapper. os_hint now names the actual resolved shell (e.g. zsh on macOS) instead of always saying "bash"; bash and zsh share command-line syntax so no separate syntax rules are needed — only an accurate name. Co-Authored-By: Claude Opus 4.8 <[email protected]>
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
…5760d shell 执行加固:PS flags + 跨平台 prompt 借鉴 + Unix 登录 shell env
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
…5760d shell 执行加固:PS flags + 跨平台 prompt 借鉴 + Unix 登录 shell env
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
…5760d shell 执行加固:PS flags + 跨平台 prompt 借鉴 + Unix 登录 shell env
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
…5760d shell 执行加固:PS flags + 跨平台 prompt 借鉴 + Unix 登录 shell env
huichen
pushed a commit
that referenced
this pull request
Jul 16, 2026
…5760d shell 执行加固:PS flags + 跨平台 prompt 借鉴 + Unix 登录 shell env
huichen
added a commit
that referenced
this pull request
Oct 13, 2026
- Wheel/trackpad scroll zooms with cursor as anchor point. - Double-click toggles between fit-to-window and 100% actual size. - Added on-screen zoom in/out/reset controls with scale indicator. - Drag (or hold space and drag) to pan when zoomed; panning clamped to image bounds. - Extracted pure zoom math to imageZoom.ts with full unit test coverage. - Added UI tests for double-click toggle, wheel zoom bounds, and reset. - Updated en/zh i18n strings for zoom controls. Refs: remote-parity audit #5 (desktop image preview zoom)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
承接 PR #4,借鉴 opencode / Claude Code 的 shell 层做的一组加固。
改动
-NonInteractive -NoLogo(防交互提示卡死、去 5.1 横幅);os_hint 教 5.1 短路写法cmd1; if ($?) { cmd2 }。cat/Get-Content);Windows 带空格路径用调用运算符& "...";PS 5.1>/Out-File默认 UTF-16+BOM 提示。command not found):启动时(tokio 前)跑$SHELL -l -i -c抓 env,取 PATH + 增量合并;修 GUI 从访达启动只有极简 PATH、找不到用户装的工具(nvm/Homebrew/npm-global)的问题。5s 超时兜底,Windows no-op。实机验证:极简 PATH 启动 →hydrated PATH from login shell (/bin/zsh)。$SHELL(bash/zsh)→ 探测 → 兜底 sh,拒绝 fish/nu;os_hint 如实报出探测到的 shell。验证
🤖 Generated with Claude Code