github / github/copilot-cli

Expose total_files_modified in the status line payload

未关闭
#3,404 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area:configuration
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

## Feature request: expose `total_files_modified` in the status line payload

### Context

The configurable status line (`statusLine.command`) receives a JSON payload on stdin with a `cost` object that currently includes:

```js
cost: {
total_api_duration_ms,
total_lines_added,
total_lines_removed,
total_duration_ms,
total_premium_requests
}
```

`total_lines_added` / `total_lines_removed` are great for showing a `+12/-3`‑style diff summary, but there's no companion field for the **number of files touched** in the session.

### Proposal

Add `total_files_modified: number` (the count, not the array) to the `cost` payload sent to the status line script. The runtime already tracks `codeChanges.filesModified` internally (it surfaces in `/usage` and in `session.shutdown` events), so this is essentially exposing existing state.

```js
cost: {
total_api_duration_ms,
total_lines_added,
total_lines_removed,
total_files_modified, // ← new
total_duration_ms,
total_premium_requests
}
```

### Use case

Status line scripts can render a more complete change summary, e.g.:

```
Context 25k/100k [bar] 25% · ↑112k ⊚80k ↓5k ($0.35) · +42/-13 in 4 files
```

This is the natural complement to the line‑count fields and matches how most diff tools summarize changes (lines + file count).

### Why a count and not the list

Sending the full path list would bloat the payload on long sessions and leak filesystem context unnecessarily. A simple integer count is enough for the status‑line use case.

### Alternative considered

Reading `~/.copilot/session-state//events.jsonl` from the script — rejected as fragile (race conditions with the writer, 200 ms refresh budget, parsing a growing JSONL on every tick).

贡献指南

打开贡献指南

调研方向

从 statusLine.command 的 payload 构造开始,跟踪现有成本字段如何从 runtime 的 codeChanges.filesModified 状态中组装。将计数与其他成本字段一起添加,然后验证 status line 接收到的 total_files_modified 是一个数字,并且现有的 payload 字段保持不变。

由索引模型根据 Issue 内容生成。

评估

技术栈
shell
领域
cli
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。