qwen-code/packages/cli/src/utils
Ziqiang Li e250d6e314
Some checks are pending
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none (push) Waiting to run
E2E Tests / E2E Test - macOS (push) Waiting to run
E2E Tests / web-shell Browser Regression (push) Waiting to run
feat: add qwen update and /update commands with auto-update support (#5780)
* fix: align standalone-update RC markers with install script, add version to update output

## Changes

### Compatibility fixes (standalone-update.ts)
- ensurePathInShellRc: use install script's begin/end block markers (# Qwen Code PATH block begin/end) instead of single-line marker, preventing duplicate PATH entries
- ensurePathInShellRc: fish shell uses set -gx PATH (matching install script)
- ensurePathInShellRc: use single-quoted paths with shell_quote-style escaping
- ensureBinWrapper: use #!/usr/bin/env sh shebang (matching install script)

### Version output
- qwen update: show current version in 'up to date' message (Qwen Code X.Y.Z is up to date!)
- /update slash command: same version display

### Build fix
- esbuild.config.js: add ink/dom and ink/components/CursorContext aliases for ink 7.x compatibility

### i18n
- en.js: add 9 update-related translation keys

Co-Authored-By: Claude <noreply@anthropic.com>

* i18n: add update command translations for all 8 non-English locales

- zh: Simplified Chinese
- zh-TW: Traditional Chinese
- ja: Japanese
- ru: Russian
- de: German
- pt: Portuguese (Brazil)
- fr: French
- ca: Catalan

Co-Authored-By: Claude <noreply@anthropic.com>

* fix update command review feedback

* address update command review followups

* fix update command test args type

* address update review hardlink and fallback feedback

* fix update tar filter typing and sdk bundle guard

* fix(cli): address update review feedback

* address update review followups

* restore windows archive traversal scan

* address update review observations

* address latest update review findings

* fix latest update review regressions

* fix(cli): localize update command output

* fix(cli): localize update install guidance

* fix(cli): harden update review follow-ups

* fix(cli): address latest update review comments

* fix(cli): honor explicit update requests

* fix(cli): address update command review feedback

* fix(cli): address update slash command review feedback

* fix(cli): address latest update review feedback

* fix(cli): address update review follow-ups

* add code

* fix(cli): add .deferred marker to prevent Windows deferred update race

On Windows, when atomicReplace returns 'deferred', a bat script runs
detached to complete the swap after the Node process exits. The lock
file alone was insufficient because acquireLock falls through when the
Node PID is dead (process.kill check), allowing a second `qwen update`
to steal the lock and interfere with the in-flight bat script.

Add a .deferred marker file containing the bat script's PID. acquireLock
now checks this marker via isProcessAlive(batPid) before allowing lock
theft, blocking concurrent updates while the swap is still in progress.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(cli): harden update review edge cases

* fix(cli): address PR #5780 review feedback on update engine

* test(cli): fix update check test import

* fix(cli): avoid duplicate startup update checks

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: 易良 <1204183885@qq.com>
Co-authored-by: liziwl <23000702+liziwl@users.noreply.github.com>
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev-bot@users.noreply.github.com>
Co-authored-by: yiliang114 <effortyiliang@gmail.com>
2026-07-09 15:11:45 +00:00
..
housekeeping feat: revivable background sub-agents and subagent transcript TTL (#5556) 2026-06-22 14:34:07 +08:00
acpModelUtils.test.ts feat(cli): support inline one-shot model override in /model (#5967) (#6022) 2026-06-30 22:45:31 +00:00
acpModelUtils.ts feat(cli): support inline one-shot model override in /model (#5967) (#6022) 2026-06-30 22:45:31 +00:00
apiPreconnect.test.ts Pin fetch to bundled undici for undici higher versions compatibility (#4238) 2026-05-20 22:26:05 +08:00
apiPreconnect.ts refactor(auth): unify provider config in core, simplify /auth as "Connect a Provider" (#4287) 2026-05-20 23:48:52 +08:00
chat-record-tool-call-id.ts feat(daemon): Add session export endpoint (#6297) 2026-07-04 09:33:44 +00:00
checks.ts chore(build/compiler): Enable a bunch of strict TS compiler options. (#6138) 2025-08-13 20:17:38 +00:00
cleanup.test.ts perf(core): cut runtime sync I/O on tool hot path by 91% (#3581) 2026-04-24 21:17:51 +08:00
cleanup.ts perf(cli): Optimize serve daemon startup (#5785) 2026-06-24 17:50:31 +08:00
commands.test.ts feat(cli): support stacked slash-skill invocations (#6361) 2026-07-07 06:38:04 +00:00
commands.ts feat(cli): support stacked slash-skill invocations (#6361) 2026-07-07 06:38:04 +00:00
commentJson.test.ts fix(cli): persist MCP server removals (#4535) 2026-05-26 17:57:41 +08:00
commentJson.ts fix(cli): persist MCP server removals (#4535) 2026-05-26 17:57:41 +08:00
costCalculator.test.ts Feat/stats model cost estimation rebase (#3780) 2026-05-03 07:31:08 +08:00
costCalculator.ts Feat/stats model cost estimation rebase (#3780) 2026-05-03 07:31:08 +08:00
cpuProfiler.test.ts feat(cli): add CPU profiling support for Chrome DevTools analysis (#4620) 2026-06-03 03:01:29 +00:00
cpuProfiler.ts feat(cli): add CPU profiling support for Chrome DevTools analysis (#4620) 2026-06-03 03:01:29 +00:00
deepMerge.test.ts Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
deepMerge.ts Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
dialogScopeUtils.ts Add Interactive Approval Mode Dialog (#1012) 2025-11-13 19:02:53 +08:00
doctorChecks.test.ts refactor(core): remove GitService, migrate /restore to FileHistoryService (#4871) 2026-06-09 18:34:31 +08:00
doctorChecks.ts refactor(core): remove GitService, migrate /restore to FileHistoryService (#4871) 2026-06-09 18:34:31 +08:00
earlyInputCapture.test.ts feat(vscode-companion): support /export session command (#2592) 2026-04-24 17:55:26 +08:00
earlyInputCapture.ts feat(vscode-companion): support /export session command (#2592) 2026-04-24 17:55:26 +08:00
envVarResolver.test.ts Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
envVarResolver.ts feat: move extension to core package 2026-01-14 15:30:27 +08:00
errors.test.ts feat(cli): add --json-schema for structured output in headless mode (#3598) 2026-05-11 14:21:55 +08:00
errors.ts feat(cli): headless / non-interactive runaway-protection guardrails (#4103) (#4502) 2026-05-26 00:06:26 +08:00
events.ts feat: extension file reload — watch for plugin changes and hot-reload runtime (#6347) 2026-07-08 11:16:21 +00:00
extension-mention.ts feat(daemon): support @extension mentions (#6008) 2026-06-29 16:30:47 +00:00
gitUtils.test.ts feat(serve): Add daemon workspace voice and control APIs (#5765) 2026-06-24 23:48:57 +00:00
gitUtils.ts feat(serve): Add daemon workspace voice and control APIs (#5765) 2026-06-24 23:48:57 +00:00
handleAutoUpdate.test.ts feat: add qwen update and /update commands with auto-update support (#5780) 2026-07-09 15:11:45 +00:00
handleAutoUpdate.ts feat: add qwen update and /update commands with auto-update support (#5780) 2026-07-09 15:11:45 +00:00
headlessSafetyWarnings.test.ts fix(cli): Keep serve health responsive before runtime load (#6013) 2026-06-30 10:39:08 +00:00
headlessSafetyWarnings.ts fix(cli): Keep serve health responsive before runtime load (#6013) 2026-06-30 10:39:08 +00:00
installationInfo.test.ts feat: add qwen update and /update commands with auto-update support (#5780) 2026-07-09 15:11:45 +00:00
installationInfo.ts feat: add qwen update and /update commands with auto-update support (#5780) 2026-07-09 15:11:45 +00:00
languageUtils.test.ts fix(cli): normalize english output language (#5346) 2026-06-19 03:39:37 +08:00
languageUtils.ts fix(cli): normalize english output language (#5346) 2026-06-19 03:39:37 +08:00
math.ts Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
mcp-server-mention.ts feat(web-shell): add MCP mentions and iconized @ references (#6279) 2026-07-04 02:13:42 +00:00
memoryDiagnostics.test.ts feat(cli): add baseline /doctor memory diagnostics (#4180) 2026-05-16 17:19:50 +08:00
memoryDiagnostics.ts feat(cli): add baseline /doctor memory diagnostics (#4180) 2026-05-16 17:19:50 +08:00
midTurnUserMessage.test.ts fix(cli): Preserve mid-turn image messages (#5183) 2026-06-18 09:24:55 +08:00
midTurnUserMessage.ts fix(cli): Preserve mid-turn image messages (#5183) 2026-06-18 09:24:55 +08:00
modelConfigUtils.test.ts feat(cli): Add serve env isolation and total admission (#6416) 2026-07-08 00:52:36 +00:00
modelConfigUtils.ts feat(cli): Add serve env isolation and total admission (#6416) 2026-07-08 00:52:36 +00:00
nonInteractiveHelpers.test.ts feat(core,cli,sdk): resume an interrupted turn without a synthetic "continue" message (#5030) 2026-06-28 13:24:06 +00:00
nonInteractiveHelpers.ts feat(core,cli,sdk): resume an interrupted turn without a synthetic "continue" message (#5030) 2026-06-28 13:24:06 +00:00
osc.test.ts feat(cli): add OSC notification support for iTerm2, Kitty, and Ghostty (#3562) 2026-04-27 20:28:07 +08:00
osc.ts feat(cli): add OSC notification support for iTerm2, Kitty, and Ghostty (#3562) 2026-04-27 20:28:07 +08:00
package.ts perf(cli): Optimize serve daemon startup (#5785) 2026-06-24 17:50:31 +08:00
processUtils.test.ts Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
processUtils.ts Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
readStdin.test.ts fix(cli): enforce stdin byte limit (#5331) 2026-06-19 03:37:21 +08:00
readStdin.ts fix(cli): enforce stdin byte limit (#5331) 2026-06-19 03:37:21 +08:00
relaunch.test.ts feat(cli): Add settings JSON corrupted warning dialog (#4560) 2026-05-31 18:02:20 +08:00
relaunch.ts feat(cli): Add settings JSON corrupted warning dialog (#4560) 2026-05-31 18:02:20 +08:00
resolvePath.test.ts fix(cli): Support Windows-style tilde paths (#6029) 2026-06-30 13:57:47 +00:00
resolvePath.ts fix(cli): Support Windows-style tilde paths (#6029) 2026-06-30 13:57:47 +00:00
runBudget.test.ts feat(cli): headless / non-interactive runaway-protection guardrails (#4103) (#4502) 2026-05-26 00:06:26 +08:00
runBudget.ts feat(cli): headless / non-interactive runaway-protection guardrails (#4103) (#4502) 2026-05-26 00:06:26 +08:00
sandbox-macos-permissive-closed.sb feat(core): support QWEN_HOME env var to customize config directory (#2953) 2026-05-09 15:51:52 +08:00
sandbox-macos-permissive-open.sb feat(core): support QWEN_HOME env var to customize config directory (#2953) 2026-05-09 15:51:52 +08:00
sandbox-macos-permissive-proxied.sb feat(core): support QWEN_HOME env var to customize config directory (#2953) 2026-05-09 15:51:52 +08:00
sandbox-macos-restrictive-closed.sb feat(core): support QWEN_HOME env var to customize config directory (#2953) 2026-05-09 15:51:52 +08:00
sandbox-macos-restrictive-open.sb feat(core): support QWEN_HOME env var to customize config directory (#2953) 2026-05-09 15:51:52 +08:00
sandbox-macos-restrictive-proxied.sb feat(core): support QWEN_HOME env var to customize config directory (#2953) 2026-05-09 15:51:52 +08:00
sandbox-path.ts fix(cli): respect sandbox path boundaries (#5375) 2026-06-19 12:31:30 +08:00
sandbox.test.ts fix: resolve macOS seatbelt profile path from bundle dir, not chunks/ (#6172) 2026-07-02 22:27:45 +00:00
sandbox.ts fix: resolve macOS seatbelt profile path from bundle dir, not chunks/ (#6172) 2026-07-02 22:27:45 +00:00
sandboxImageName.ts fix(cli): parse sandbox image registry ports (#5325) 2026-06-19 04:15:47 +08:00
sandboxMounts.ts fix(cli): parse sandbox mounts with windows drives (#5388) 2026-06-19 15:33:53 +08:00
sessionPaths.test.ts feat(cli): add session path status command (#4124) 2026-05-20 16:33:19 +08:00
sessionPaths.ts feat(cli): add session path status command (#4124) 2026-05-20 16:33:19 +08:00
settingsUtils.test.ts fix(core): configurable vision bridge timeout + retry with fresh budget (#6541) 2026-07-08 23:24:39 +00:00
settingsUtils.ts fix(core): configurable vision bridge timeout + retry with fresh budget (#6541) 2026-07-08 23:24:39 +00:00
spawnWrapper.ts chore: consistently import node modules with prefix (#3013) 2025-08-25 20:11:27 +00:00
standalone-update-verify.test.ts feat(cli): add standalone auto-update support (#4629) 2026-06-04 22:53:12 +08:00
standalone-update-verify.ts feat(cli): add standalone auto-update support (#4629) 2026-06-04 22:53:12 +08:00
standalone-update.test.ts feat: add qwen update and /update commands with auto-update support (#5780) 2026-07-09 15:11:45 +00:00
standalone-update.ts feat: add qwen update and /update commands with auto-update support (#5780) 2026-07-09 15:11:45 +00:00
startupProfiler.test.ts perf(cli): Optimize serve daemon startup (#5785) 2026-06-24 17:50:31 +08:00
startupProfiler.ts perf(cli): Optimize serve daemon startup (#5785) 2026-06-24 17:50:31 +08:00
startupWarnings.test.ts Sync upstream Gemini-CLI v0.8.2 (#838) 2025-10-23 09:27:04 +08:00
startupWarnings.ts Merge tag 'v0.3.0' into chore/sync-gemini-cli-v0.3.0 2025-09-11 16:26:56 +08:00
stdioHelpers.ts feat(cli): migrate console calls to debugLogger and stdioHelpers (M3 Phase 7-9) 2026-01-26 15:02:37 +08:00
systemInfo.test.ts feat(cli): prevent system sleep while running (#4434) 2026-06-08 11:39:41 +08:00
systemInfo.ts feat(cli): add tabbed Settings dialog with Status and Stats tabs (#6044) 2026-07-01 16:31:34 +08:00
systemInfoFields.test.ts fix(lsp): expose status and startup diagnostics (#3649) 2026-05-17 01:42:28 +08:00
systemInfoFields.ts refactor(auth): unify provider config in core, simplify /auth as "Connect a Provider" (#4287) 2026-05-20 23:48:52 +08:00
terminalSequence.test.ts fix(cli): reject malformed terminal sequences (#5305) 2026-06-19 04:11:25 +08:00
terminalSequence.ts fix(cli): reject malformed terminal sequences (#5305) 2026-06-19 04:11:25 +08:00
truncatedDiffPreview.ts fix(core): shrink file diff session records (#3872) 2026-05-06 20:48:24 +08:00
updateEventEmitter.ts chore: consistently import node modules with prefix (#3013) 2025-08-25 20:11:27 +00:00
userPromptExpansionHook.test.ts feat(core): add user prompt expansion hooks (#4377) 2026-06-05 13:59:12 +08:00
userPromptExpansionHook.ts feat(core): add user prompt expansion hooks (#4377) 2026-06-05 13:59:12 +08:00
userStartupWarnings.test.ts chore(cli): drop redundant home-directory startup warning (#5839) 2026-06-25 18:47:34 +00:00
userStartupWarnings.ts chore(cli): drop redundant home-directory startup warning (#5839) 2026-06-25 18:47:34 +00:00
version.ts # 🚀 Sync Gemini CLI v0.2.1 - Major Feature Update (#483) 2025-09-01 14:48:55 +08:00
warningHandler.test.ts fix(core): stop AbortSignal listener leak in long sessions (MaxListenersExceededWarning) (#4366) 2026-05-26 14:21:49 +08:00
warningHandler.ts fix(core): stop AbortSignal listener leak in long sessions (MaxListenersExceededWarning) (#4366) 2026-05-26 14:21:49 +08:00
windowTitle.test.ts feat(cli): display session name in terminal title (#5288) 2026-06-19 06:44:29 +08:00
windowTitle.ts feat(cli): display session name in terminal title (#5288) 2026-06-19 06:44:29 +08:00
writeWithBackup.test.ts feat(config): add settings file change detection via chokidar watcher (#3696) (#4933) 2026-06-19 15:00:44 +08:00
writeWithBackup.ts feat(config): add settings file change detection via chokidar watcher (#3696) (#4933) 2026-06-19 15:00:44 +08:00