Skip to content

[P2] Unstaged new directories don't show files under local changes #210

@jacob-petterle

Description

@jacob-petterle

Overview

When a new directory is created with files inside (unstaged), the directory appears in the Changes tab but the files inside it don't show up recursively. Once the directory is staged, all the files inside become visible.


Problem

Current behavior:

  1. Create a new directory with files: mkdir new-dir && touch new-dir/file1.js new-dir/file2.js
  2. View Changes tab → Unstaged Changes
  3. Only see new-dir/ (directory entry) without the files inside
  4. Stage the directory: git add new-dir
  5. Now all files inside show up: new-dir/file1.js, new-dir/file2.js

Expected behavior:

  • Unstaged new directories should show all files inside recursively
  • Same as git status behavior

Suspected Cause

Possible issues:

  1. Git diff parsing - Not recursively expanding new directories in unstaged changes
  2. Stale closure - Component not re-rendering when new files detected
  3. Git command - May need different flags for untracked directories

Git Commands Used

Check what commands are being used in apps/server/src/tools/get-local-changes.ts or wherever local changes are fetched:

# This shows untracked files flat (might be what we're using)
git status --porcelain

# This shows untracked files recursively (what we might need)
git status --porcelain -uall

# Or use git ls-files for untracked
git ls-files --others --exclude-standard

Reproduction Steps

  1. In a plan's linked repository:

    mkdir new-feature
    echo "test" > new-feature/index.js
    echo "test" > new-feature/utils.js
  2. Open Shipyard → Changes tab → Local Changes

  3. Check "Unstaged Changes" section

  4. Bug: Only see new-feature/ without files inside

  5. Stage the directory: git add new-feature

  6. Works: Now see new-feature/index.js and new-feature/utils.js in "Staged Changes"


Related Issue

This is different from #184 (phantom staged files with +0 -0), though both are in the Changes tab.

#184: Staged files show with no diff content (+0 -0)
This issue: Unstaged directories don't show files inside


Expected Fix

When fetching unstaged changes, ensure:

  1. New directories are recursively expanded to show all files
  2. Each file has a diff preview (if applicable)
  3. Matches behavior of git status -uall or equivalent

Files to Check

  • apps/server/src/tools/get-local-changes.ts - How local changes are fetched
  • apps/web/src/components/ChangesView.tsx - How changes are displayed
  • apps/web/src/hooks/useLocalChanges.ts - Local changes hook (if exists)
  • Git command execution - Check flags/options used

Acceptance Criteria

  • Unstaged new directories show all files inside recursively
  • Behavior matches git status -uall
  • No performance degradation with large directories
  • Works for nested directories (dir/subdir/file.js)
  • Doesn't break existing staged changes display

Priority

P2 - Confusing UX but has workaround (stage the directory first).


Created 2026-01-28

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Priority 2: Near-term (1-2 months)bugSomething isn't workinguiUser interface / visual design

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions