5935dcfaf6 fix(cli): eliminate banner duplication and drag flicker on resize/wake (#8831)
* fix(cli): clear the VP viewport on wake/SIGCONT repaints

useWakeRepaint (#7265) repaints via refreshStatic after sleep/wake or
SIGCONT, but in VP mode (default) refreshStatic neither cleared the screen
nor repainted anything (<Static> is not rendered in VP), so Ink's next
relative erase ran against a stale/rearranged terminal buffer: frame-top
residue (banner), frame-height jumps and high-frequency flicker on every
terminal. Blank the alternate-screen viewport (2J+H, no 3J so scrollback /
Warp block history survives) before the remount-driven repaint; static mode
keeps its existing clearTerminal.

Co-authored-by: Qwen-Coder <[email protected]>

* fix(cli): repaint VP from a clean viewport after width shrinks

On shrink the terminal reflows the printed frame into more physical rows
than Ink's stale eraseLines count, so every subsequent redraw under-erases
and strands the frame top (banner) as stacked duplicates on all terminals
(issue #8557). For a short window after a shrink, start each VP redraw from
a clean viewport (2J+H); Static mode keeps a conservative reflow-aware
amplification so committed scrollback is never touched.

* fix(cli): enable DEC synchronized output on Warp to reduce redraw flicker

Warp answers the DECRQM 2026 probe with status 2 (recognized, reset), so
synchronized updates are available there. Without them Warp renders ink's
erase-then-rewrite frame pattern as visible flicker (issue #8557). Add
WarpTerminal to the synchronized-output allowlist; the existing
QWEN_CODE_DISABLE_SYNCHRONIZED_OUTPUT escape hatch covers regressions.

* fix(cli): guarantee VP wake repaint by replaying the last frame

Ink skips redraws whose output is unchanged, so the VP wake/SIGCONT path's
viewport clear could leave the screen blank until the next state change
(review #8831). The resize-reflow wrapper now caches the last frame that
reached the terminal and repaint() replays it over a clean viewport; the
stale design-rationale comment is rewritten to match.

* fix(cli): address #8831 review — LIFO teardown, grow reset, bare-redraw model handoff, wake-only repaint

- Unwind the stdout.write wrapper stack in LIFO order so the identity-
  guarded restores do not leak wrappers (Critical).
- Reset a pending static-mode amplification on grow so a stale count can
  never over-erase into committed scrollback (Critical).
- Hand the frame model over to Ink's bare post-shrink redraw (log.clear
  resets its counter, so the redraw carries no erase prefix); consecutive
  shrinks now amplify from the actual post-shrink frame (Critical).
- repaint() skips the replay when the cached frame's width differs from the
  current viewport (Critical).
- Route the clear-and-replay through useWakeRepaint only; refreshStatic's VP
  branch stays write-free for ordinary callers (/clear, model change, ...)
  so stale frames never flash back (Critical).
- Use ansi-escapes exports instead of hand-rolled ANSI constants; drop the
  duplicated WarpTerminal test row; add tests for the grow reset, the bare-
  redraw handoff, the MIN_FRAME_LINES guard and the clear-window expiry.

* fix(cli): address #8831 R3 review — model fidelity and wake remount

- Frame model now lazy and terminal-faithful: per-character greedy packing
  (wide chars waste a row-tail cell), physical-row segmentation on shrink
  (terminals re-wrap rows without re-joining), and Ink's cursor-below line
  included for frames ending with a newline (R3-3, R3-4, R3-5, R3-9).
- expectFrame handoff survives Ink's real write sequence: standalone
  synchronized-output control writes no longer consume it, and consecutive
  bare writes re-model with last-wins so static commits model the live
  frame, not the transcript (R3-1, R3-14).
- VP wake path bumps historyRemountKey again so one-shot <Static> history
  (agent tabs) is re-emitted over the clear; selection extracted into
  buildWakeRepaint for unit coverage (R3-2, R2-8).
- Shared erase grammar helpers exported from terminalRedrawOptimizer
  (R3-13); tests added for the escape hatch, repaint fallbacks, BSU
  sequences, static commits, trailing newlines and CJK packing
  (R3-10, R3-11, R3-12).

* fix(cli): address #8831 R3 review — raw-repack reflow model, wake remount bump, hardened frame handoff

* fix(cli): address #8831 R4 review — stripped-width model, legacy wake write-free, untrusted anchors, full-reset resets

- Model widths from ANSI-stripped content (SGR bytes are not cells) while
  repaint replays the raw styled frame.
- QWEN_CODE_LEGACY_RESIZE_ERASE VP wake stays write-free (remount bump only)
  instead of blanking via a bare viewport clear.
- Erase-prefixed printable writes re-model unconditionally (live region can
  legitimately shrink below MIN_FRAME_LINES); bare full-reset redraws
  (clearTerminal + full static history) reset the model instead of poisoning
  it; second printable bare write (live frame after static append) bypasses
  the line-count guard.
- Skip amplification when the return-to-bottom prefix carries cursorDown
  computed from pre-reflow geometry (untrusted anchor).
- Tests for all R4 scenarios plus wrapper-stack contracts (stacked install
  order, LIFO teardown) and the AppContainer wake wiring.

Co-authored-by: Qwen-Coder <[email protected]>

* fix(cli): address #8831 R4 review — stripped-width modeling, trusted-anchor amplification, wake/legacy hardening, close test gaps

* test(cli): force the sync wrapper in the LIFO teardown test for CI determinism

* refactor(cli): drop unused exports from terminalRedrawOptimizer

* fix(cli): address #8831 R6 review — trusted-anchor amplify with prefix delta, ungated full-reset, grapheme/tab packing, VP shrink remount, test hardening

* fix(cli): address #8831 R7 review — bounded bare-write handoff, window-end static re-bump, deps-capture wiring test

---------

Co-authored-by: 秦奇 <[email protected]>
Co-authored-by: Qwen-Coder <[email protected]>
2026-08-11 07:45:09 +00:00
2025-07-22 23:26:01 +08:00
2025-07-22 23:26:01 +08:00
2025-08-08 20:45:54 +08:00
2025-07-22 23:26:01 +08:00
2026-08-10 15:27:45 +00:00
2025-10-23 09:27:04 +08:00
2025-12-22 21:11:33 +08:00
2026-08-10 15:27:45 +00:00

npm version License Node.js Version Downloads

QwenLM%2Fqwen-code | Trendshift

The open-source AI coding agent that lives in your terminal.

中文 | Deutsch | français | 日本語 | Русский | Português (Brasil) | 한국어

Why Qwen Code?

  • Agentic out of the box — Auto-Memory, Auto-Skills, SubAgents, Agent Teams, and MCP. Dynamic workflows, zero setup.
  • Open-source, inside and out — The framework and the Qwen models are open-source. They evolve together. No vendor lock-in.
  • Multi-protocol — Supports OpenAI, Anthropic, Gemini, and Qwen APIs. Any third-party provider or local model (Ollama / vLLM). Switch at runtime.
  • Beyond the terminal — IDE plugins, Desktop app, daemon mode, SDKs, and IM bots (Telegram / DingTalk / WeChat / Feishu).

Tip

Qwen Code is actively iterating on itself — using its own agent and models to file issues, submit PRs, review code, and run tests. Powered by the community, driven by AI.

Installation

Linux / macOS:

curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.sh | bash

Windows:

irm https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.ps1 | iex

Restart your terminal after installation to ensure environment variables take effect.

NPM / Homebrew

NPM (requires Node.js 22+):

npm install -g @qwen-code/qwen-code@latest

Homebrew (macOS / Linux):

brew install qwen-code

Quick Start

qwen          # Launch interactive terminal UI
# Inside the session:
/auth         # Configure your provider and API key

See the Authentication Guide and Settings Reference for detailed setup.

Qwen Code

How to Use Qwen Code

Mode Command Use Case
Interactive qwen Terminal UI with rich rendering, @file references, slash commands
Headless qwen -p "..." Scripts, CI/CD, batch processing — no UI
IDE — VS Code, Zed, JetBrains
Desktop — Qwen Code Desktop — GUI for macOS, Windows, Linux
Daemon qwen serve Shared agent session over HTTP+SSE (ACP). Multiple clients, one agent. (experimental) Docs
SDK — TypeScript, Python, Java
IM Bot qwen channel Connect to Telegram, DingTalk, WeChat, or Feishu
SDK example (Python)
import asyncio

from qwen_code_sdk import is_sdk_result_message, query


async def main() -> None:
    result = query(
        "Summarize the repository layout.",
        {
            "cwd": "/path/to/project",
            "path_to_qwen_executable": "qwen",
        },
    )

    async for message in result:
        if is_sdk_result_message(message):
            print(message["result"])


asyncio.run(main())

Capabilities

If you know Claude Code, you already know Qwen Code — and then some. We've put significant effort into bringing Qwen Code to feature parity with Claude Code, improving both breadth and reliability across the board.

Feature Qwen Code Claude Code
SubAgents, Agent Teams, Dynamic Workflows ✓ ✓
Auto-Memory, Auto-Skills, Hooks ✓ ✓
Built-in Skills (/review, /batch, /loop, /bugfix…) ✓ ✓
MCP, Plan Mode, LSP Integration ✓ ✓
Auto Mode, Sandbox, Git Worktrees ✓ ✓
Computer Use (desktop automation) ✓ ✓
IDE Plugins (VS Code / JetBrains / Zed) ✓ ✓
SDK ✓ ✓
Headless Mode, Session Management ✓ ✓
Open-source — model and framework ✓ —
Multi-protocol (OpenAI / Anthropic / Gemini / Qwen + any provider) ✓ —
Agent Arena (multi-model head-to-head on same task) ✓ —
Daemon Mode — qwen serve (multi-client shared agent) ✓ —
IM Channels (Telegram / DingTalk / WeChat / Feishu) ✓ —

Ecosystem

  • Qwen Code Desktop — Official desktop app for macOS, Windows, and Linux

  • AionUi — A modern GUI for command-line AI tools including Qwen Code

  • Gemini CLI Desktop — A cross-platform desktop/web/mobile UI for Qwen Code

  • 🦞 Qwen Code Claw — Let other agents (Claude, Codex, etc.) delegate coding tasks to Qwen Code via ACP. Paste this prompt into your agent:

Use Qwen Code as a coding agent. First, fetch and read this skill reference:
https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/.qwen/skills/qwen-code-claw/SKILL.md
Then follow the instructions inside to install, authenticate, and use Qwen Code via acpx for all coding tasks.
  • Aliyun Model Studio CLI — Official CLI for Aliyun's AI platform (bailian-cli). Extends Qwen Code with image/video generation, knowledge retrieval, app orchestration, and model deployment

Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

Acknowledgments

This project was originally based on Google Gemini CLI v0.8.2. We gratefully acknowledge the Gemini CLI team's excellent work. Starting from Qwen Code v0.1, we stopped syncing with upstream and began independent development as a multi-protocol, multi-platform agent framework with deep integrations for Qwen models and beyond.

Languages
TypeScript 76.5%
Java 11.5%
JavaScript 5.4%
Rust 5%
Python 0.5%
Other 0.9%