Skip to content

Files pane: wire up git change indicators for file icons #611

@pedramamini

Description

@pedramamini

Context

The Session.changedFiles field (FileArtifact[]) exists on the session interface but is never populated with actual git status data. It's initialized as [] in every session creation path (useSessionCrud.ts, useWizardHandlers.ts, worktreeSession.ts, tabHelpers.ts) and no code ever writes to it.

The file explorer already has plumbing to consume this data:

  • FileExplorerPanel.tsx:941const change = session.changedFiles?.find((f) => f.path.includes(node.name));
  • FileExplorerPanel.tsx:1021 — passes change?.type to getExplorerFileIcon()
  • Default theme has fileTypeColor() that maps added→green, modified→yellow, deleted→red

But since changedFiles is always empty, none of this has any visible effect.

Additionally, PR #609 (Files Pane Icon Theme) adds a "Rich" icon theme that accepts but ignores the _type parameter entirely in getRichExplorerFileIcon(). Once changedFiles is wired up, the rich theme will need to handle diff status too (e.g., colored dot overlay, border, or CSS filter on the <img> SVG icons).

What needs to happen

  1. Populate changedFiles — Run git status (or equivalent) and write results into session.changedFiles with proper FileArtifact.type values (added, modified, deleted). This should refresh on file tree refresh and after agent operations complete.

  2. Default theme — Already wired via fileTypeColor(). Should work once data flows. Verify visually.

  3. Rich themegetRichExplorerFileIcon currently discards _type. Add a visual indicator for change status — options include:

    • Colored dot/badge overlay on the icon
    • CSS filter or opacity shift
    • Colored left border on the file row

    Whatever approach is chosen, it should be consistent with how the default theme communicates the same information.

  4. File name match — The current lookup (f.path.includes(node.name)) is fragile and could false-match (e.g., a file named utils.ts matching src/other/utils.ts). Consider matching against the full relative path instead.

Relevant files

  • src/renderer/types/index.ts:531changedFiles: FileArtifact[] definition
  • src/renderer/components/FileExplorerPanel.tsx:941 — consumption site
  • src/renderer/utils/fileExplorerIcons/richTheme.tsxgetRichExplorerFileIcon (ignores _type)
  • src/renderer/utils/fileExplorerIcons/defaultTheme.tsxgetDefaultExplorerFileIcon (has fileTypeColor)
  • src/renderer/utils/fileExplorerIcons/shared.ts — shared types including FileChangeType

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions