mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 11:41:04 +00:00
feat(cli): support multi-line status line output (#3311)
Some checks are pending
Qwen Code CI / Lint (push) Waiting to run
Qwen Code CI / Test (push) Blocked by required conditions
Qwen Code CI / Test-1 (push) Blocked by required conditions
Qwen Code CI / Test-2 (push) Blocked by required conditions
Qwen Code CI / Test-3 (push) Blocked by required conditions
Qwen Code CI / Test-4 (push) Blocked by required conditions
Qwen Code CI / Test-5 (push) Blocked by required conditions
Qwen Code CI / Test-6 (push) Blocked by required conditions
Qwen Code CI / Test-7 (push) Blocked by required conditions
Qwen Code CI / Test-8 (push) Blocked by required conditions
Qwen Code CI / Post Coverage Comment (push) Blocked by required conditions
Qwen Code CI / CodeQL (push) Waiting to run
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
Some checks are pending
Qwen Code CI / Lint (push) Waiting to run
Qwen Code CI / Test (push) Blocked by required conditions
Qwen Code CI / Test-1 (push) Blocked by required conditions
Qwen Code CI / Test-2 (push) Blocked by required conditions
Qwen Code CI / Test-3 (push) Blocked by required conditions
Qwen Code CI / Test-4 (push) Blocked by required conditions
Qwen Code CI / Test-5 (push) Blocked by required conditions
Qwen Code CI / Test-6 (push) Blocked by required conditions
Qwen Code CI / Test-7 (push) Blocked by required conditions
Qwen Code CI / Test-8 (push) Blocked by required conditions
Qwen Code CI / Post Coverage Comment (push) Blocked by required conditions
Qwen Code CI / CodeQL (push) Waiting to run
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
* feat(cli): support multi-line status line output (#3211) Remove the single-line hard limit (.split('\n')[0]) from the status line hook so user scripts can output multiple rows. Footer renders each line as a separate <Text wrap="truncate"> element, preserving per-line horizontal truncation. Ink's virtual DOM handles re-rendering without manual ANSI cursor management. * feat(cli): cap status line output at 3 lines Prevent runaway scripts from flooding the footer — lines beyond the third are silently discarded. * docs: mention 3-line cap in status line docs and agent prompt * fix(cli): cap status line at 2 lines to keep footer within 3 rows Footer has a fixed bottom row (hint/mode indicator), so status line gets at most 2 lines to keep the total footer height at 3 rows max. * test(cli): improve useStatusLine coverage to 100% lines Add tests for: per-model metrics payload, contextWindowSize/version/ model fallbacks, config removal with pending debounce, command change cancelling pending debounce. * docs: update status line ASCII diagram for multi-line layouts Also fix TS error in test (null → null as never for mock return). * refactor(cli): return string[] from useStatusLine, filter empty lines Address review feedback: - Hook returns `lines: string[]` instead of `text: string | null`, eliminating the join/split round-trip with Footer. - Filter empty lines before slicing so leading blanks don't eat real content (e.g. "\n\nreal content" no longer yields ["", ""]). - Export MAX_STATUS_LINES with comment explaining the 3-row constraint. - Use `status-line-${i}` as React key for clarity. * test(cli): add Footer multi-line rendering, \r\n, and pure-newline tests Address remaining review feedback: - Footer test: mock useStatusLine, verify multi-line rendering and hint suppression. - useStatusLine test: add \r\n line ending and pure-newline edge case. * fix(cli): align right footer indicators to top When the status line has multiple rows, the left column becomes taller than the right section. The outer Box defaults to `alignItems: stretch` which caused the indicators to visually center; add `alignItems="flex-start"` on the right Box so they stay anchored to the top row. Reported via e2e test in #3311.
This commit is contained in:
parent
30c5eeaf20
commit
b004450d7f
18 changed files with 335 additions and 117 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Every Qwen Code session starts with a fresh context window. Two mechanisms carry knowledge across sessions so you don't have to re-explain yourself every time:
|
||||
|
||||
- **QWEN.md** — instructions *you* write once and Qwen reads every session
|
||||
- **QWEN.md** — instructions _you_ write once and Qwen reads every session
|
||||
- **Auto-memory** — notes Qwen writes itself based on what it learns from you
|
||||
|
||||
---
|
||||
|
|
@ -24,9 +24,9 @@ Don't include things Qwen can figure out by reading your code. QWEN.md works bes
|
|||
|
||||
### Where to create QWEN.md
|
||||
|
||||
| File | Who it applies to |
|
||||
|---|---|
|
||||
| `~/.qwen/QWEN.md` | You, across all your projects |
|
||||
| File | Who it applies to |
|
||||
| ----------------------------- | --------------------------------------------- |
|
||||
| `~/.qwen/QWEN.md` | You, across all your projects |
|
||||
| `QWEN.md` in the project root | Your whole team (commit it to source control) |
|
||||
|
||||
You can have both. Qwen loads all QWEN.md files it finds when you start a session — your personal one plus any in the project.
|
||||
|
|
@ -45,6 +45,7 @@ You can point QWEN.md at other files so Qwen reads them too:
|
|||
See @README.md for project overview.
|
||||
|
||||
# Conventions
|
||||
|
||||
- Git workflow: @docs/git-workflow.md
|
||||
```
|
||||
|
||||
|
|
@ -62,12 +63,12 @@ This is different from QWEN.md: you don't write it, Qwen does.
|
|||
|
||||
Qwen looks for four kinds of things worth remembering:
|
||||
|
||||
| What | Examples |
|
||||
|---|---|
|
||||
| **About you** | Your role, background, how you like to work |
|
||||
| **Your feedback** | Corrections you made, approaches you confirmed |
|
||||
| **Project context** | Ongoing work, decisions, goals not obvious from the code |
|
||||
| **External references** | Dashboards, ticket trackers, docs links you mentioned |
|
||||
| What | Examples |
|
||||
| ----------------------- | -------------------------------------------------------- |
|
||||
| **About you** | Your role, background, how you like to work |
|
||||
| **Your feedback** | Corrections you made, approaches you confirmed |
|
||||
| **Project context** | Ongoing work, decisions, goals not obvious from the code |
|
||||
| **External references** | Dashboards, ticket trackers, docs links you mentioned |
|
||||
|
||||
Qwen doesn't save everything — only things that would actually be useful next time.
|
||||
|
||||
|
|
@ -150,6 +151,7 @@ Runs the memory cleanup now instead of waiting for the automatic schedule:
|
|||
Open `/memory` to see which files are loaded. If your file isn't listed, Qwen can't see it — make sure it's in the project root or `~/.qwen/`.
|
||||
|
||||
Instructions work better when they're specific:
|
||||
|
||||
- ✓ `Use 2-space indentation for TypeScript files`
|
||||
- ✗ `Format code nicely`
|
||||
|
||||
|
|
|
|||
|
|
@ -5,14 +5,21 @@
|
|||
The status line lets you run a shell command whose output is displayed in the footer's left section. The command receives structured JSON context via stdin, so it can show session-aware information like the current model, token usage, git branch, or anything else you can script.
|
||||
|
||||
```
|
||||
With status line (default approval mode — 1 row):
|
||||
Single-line status (default approval mode — 1 row):
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ user@host ~/project (main) ctx:34% 🔒 docker | Debug | 67% │ ← status line
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
|
||||
With status line + non-default mode (2 rows):
|
||||
Multi-line status (up to 2 lines — 2 rows):
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ user@host ~/project (main) ctx:34% 🔒 docker | Debug | 67% │ ← status line
|
||||
│ user@host ~/project (main) ctx:34% 🔒 docker | Debug | 67% │ ← status line 1
|
||||
│ ████████░░░░░░░░░░ 34% context │ ← status line 2
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Multi-line status + non-default mode (3 rows max):
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ user@host ~/project (main) ctx:34% 🔒 docker | Debug | 67% │ ← status line 1
|
||||
│ ████████░░░░░░░░░░ 34% context │ ← status line 2
|
||||
│ auto-accept edits (shift + tab to cycle) │ ← mode indicator
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
|
@ -53,10 +60,10 @@ Add a `statusLine` object under the `ui` key in `~/.qwen/settings.json`:
|
|||
}
|
||||
```
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| --------- | ----------- | -------- | ------------------------------------------------------------------------------------- |
|
||||
| `type` | `"command"` | Yes | Must be `"command"` |
|
||||
| `command` | string | Yes | Shell command to execute. Receives JSON via stdin, first line of stdout is displayed. |
|
||||
| Field | Type | Required | Description |
|
||||
| --------- | ----------- | -------- | --------------------------------------------------------------------------------------- |
|
||||
| `type` | `"command"` | Yes | Must be `"command"` |
|
||||
| `command` | string | Yes | Shell command to execute. Receives JSON via stdin, stdout is displayed (up to 2 lines). |
|
||||
|
||||
## JSON input
|
||||
|
||||
|
|
@ -220,7 +227,7 @@ Then reference it in settings:
|
|||
|
||||
- **Update triggers**: The status line updates when the model changes, a new message is sent (token count changes), vim mode is toggled, git branch changes, tool calls complete, or file changes occur. Updates are debounced (300ms).
|
||||
- **Timeout**: Commands that take longer than 5 seconds are killed. The status line clears on failure.
|
||||
- **Output**: Only the first line of stdout is used. The text is rendered with dimmed colors in the footer's left section and truncated if it exceeds the available width.
|
||||
- **Output**: Multi-line output is supported (up to 2 lines; extra lines are discarded). Each line is rendered as a separate row with dimmed colors in the footer's left section. Lines that exceed the available width are truncated.
|
||||
- **Hot reload**: Changes to `ui.statusLine` in settings take effect immediately — no restart required.
|
||||
- **Shell**: Commands run via `/bin/sh` on macOS/Linux. On Windows, `cmd.exe` is used by default — wrap POSIX commands with `bash -c "..."` or point to a bash script (e.g. `bash ~/.qwen/statusline-command.sh`).
|
||||
- **Removal**: Delete the `ui.statusLine` key from settings to disable. The "? for shortcuts" hint returns.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue