fix(cli): clarify cumulative statusline token labels (#5400)

This commit is contained in:
tt-a1i 2026-06-19 17:39:31 +08:00 committed by GitHub
parent 0430ff7af4
commit 73e6c7ef0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions

View file

@ -88,8 +88,8 @@ Add a `statusLine` object under the `ui` key in `~/.qwen/settings.json`:
| `model` | | Current model name without reasoning level |
| `git-branch` | Yes | Current Git branch name (hidden when not in a git repo) |
| `context-remaining` | Yes | Percentage of context window remaining (e.g. `Context 65.7% left`) |
| `total-input-tokens` | | Total input tokens used in session (e.g. `30.0k in`) |
| `total-output-tokens` | | Total output tokens used in session (e.g. `5.0k out`) |
| `total-input-tokens` | | Cumulative input tokens used in session (e.g. `30.0k total in`) |
| `total-output-tokens` | | Cumulative output tokens used in session (e.g. `5.0k total out`) |
| `current-dir` | Yes | Current working directory |
| `project-name` | | Project name (basename of working directory) |
| `pull-request-number` | | Open PR number for the current branch (requires `gh` CLI) |
@ -103,6 +103,8 @@ Add a `statusLine` object under the `ui` key in `~/.qwen/settings.json`:
Items marked **Default** are pre-selected when you first open the `/statusline` dialog.
`total-input-tokens` and `total-output-tokens` are session totals. They add up token usage across turns, so input tokens can grow quickly because each new model request includes the current conversation context again. Use `used-tokens` when you want the current prompt size instead of cumulative session spend.
### Example output
With the default items, the status line looks like:

View file

@ -163,7 +163,7 @@ describe('statusLinePresets', () => {
data,
),
).toEqual([
'qwen3-code-plus high | qwen3-code-plus | feature/pr-4087-statusline | Context 75% left | 1.2k in | 340 out | /repo/project | project | #4087 | +12 -3 | Context 25% used | Ready | v1.2.3 | 1.0k window | 250 used | session-123',
'qwen3-code-plus high | qwen3-code-plus | feature/pr-4087-statusline | Context 75% left | 1.2k total in | 340 total out | /repo/project | project | #4087 | +12 -3 | Context 25% used | Ready | v1.2.3 | 1.0k window | 250 used | session-123',
]);
});

View file

@ -406,10 +406,10 @@ export function buildStatusLinePresetParts(
}
break;
case 'total-input-tokens':
parts.push(`${formatTokenCount(data.totalInputTokens)} in`);
parts.push(`${formatTokenCount(data.totalInputTokens)} total in`);
break;
case 'total-output-tokens':
parts.push(`${formatTokenCount(data.totalOutputTokens)} out`);
parts.push(`${formatTokenCount(data.totalOutputTokens)} total out`);
break;
case 'session-id':
if (data.sessionId) {