github / github/copilot-cli

Tool timeline: skip cd/pushd prefix in shell command labels

Ouverte
#2,656 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
area:terminal-rendering area:tools
Langage dominant
Shell
Étoiles
11.2k
Forks
1.9k
Merge moyen
14 h 16 min
PR mergées (30 j)
6

Description

## Problem

When the agent runs shell commands with a `cd` prefix (very common — agents typically change to the project directory before running the actual command), the tool timeline shows the uninformative directory change instead of the meaningful command:

```
[tool]> Running: cd C:\Tools\my-project
[tool][OK 5.0s] Running: cd C:\Tools\my-project
[tool]> Running: cd C:\Tools\my-project
[tool][OK 9.6s] Running: cd C:\Tools\my-project
```

The user sees a wall of identical `cd` lines with no indication of what the agent is actually doing (creating issues, running tests, editing configs, etc.). The tool timeline is the primary way users track agent progress, and this makes it nearly useless for chained commands.

## Typical command patterns affected

```bash
cd /repo && gh issue create --title "..."
cd C:\Tools\project && npx tsc --noEmit
cd /workspace && npm run test
pushd /tmp && npm run build
Set-Location C:\src && git status
```

## Proposed solution

When rendering shell tool execution labels, split the command string on chain operators (`&&`, `||`, `;`) and skip segments that are pure directory changes (`cd`, `pushd`, `Set-Location`). Show the first meaningful command segment instead.

**Before**: `Running: cd C:\Tools\my-project`
**After**: `Running: gh issue create --title "..."`

If the entire command is just a `cd`, show it as-is (it is the only thing happening).

## Minimal logic (what we implemented server-side for our own UI)

```typescript
const segments = cmd.split(/\s*(?:&&|\|\||;)\s*/);
const meaningful = segments.find(
(s) => !/^\s*(?:cd|pushd|Set-Location)\s/i.test(s),
);
const label = (meaningful ?? segments[0] ?? "").trim();
```

This is a small UX improvement with outsized impact on readability when the agent chains commands.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Start by locating the shell tool execution label renderer and tracing how command strings become timeline labels. Compare chained commands and directory-only commands against the stated examples, then add or update relevant tests so meaningful segments are shown while a standalone directory change remains unchanged.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
shell, typescript
Domaine
cli, developer-experience
Type d'issue
Fonctionnalité
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
62/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.