@@ -193,40 +193,29 @@ def get_changed_files_prompt() -> list[str]:
193193 baseline_path = Path (".deepwork/.last_work_tree" )
194194
195195 try :
196- # Stage all changes
196+ # Stage all changes so we can see them with --cached
197197 subprocess .run (["git" , "add" , "-A" ], capture_output = True , check = False )
198198
199- # Get current changed files
199+ # Get all staged files (includes what was just staged)
200200 result = subprocess .run (
201- ["git" , "diff" , "--name-only" , "HEAD " ],
201+ ["git" , "diff" , "--name-only" , "--cached " ],
202202 capture_output = True ,
203203 text = True ,
204204 check = False ,
205205 )
206206 current_files = set (result .stdout .strip ().split ("\n " )) if result .stdout .strip () else set ()
207-
208- # Get untracked files
209- result = subprocess .run (
210- ["git" , "ls-files" , "--others" , "--exclude-standard" ],
211- capture_output = True ,
212- text = True ,
213- check = False ,
214- )
215- untracked_files = set (result .stdout .strip ().split ("\n " )) if result .stdout .strip () else set ()
216-
217- all_current = current_files | untracked_files
218- all_current = {f for f in all_current if f }
207+ current_files = {f for f in current_files if f }
219208
220209 if baseline_path .exists ():
221210 # Read baseline and find new files
222211 baseline_files = set (baseline_path .read_text ().strip ().split ("\n " ))
223212 baseline_files = {f for f in baseline_files if f }
224213 # Return files that are in current but not in baseline
225- new_files = all_current - baseline_files
214+ new_files = current_files - baseline_files
226215 return sorted (new_files )
227216 else :
228217 # No baseline, return all current changes
229- return sorted (all_current )
218+ return sorted (current_files )
230219
231220 except (subprocess .CalledProcessError , OSError ):
232221 return []
0 commit comments