aft icon indicating copy to clipboard operation
aft copied to clipboard

bash: optionally report the files a command changed (list or capped diff) in the result

Open iceteaSA opened this issue 1 month ago • 1 comments

Summary

When a shell command changes files (a generator, sed -i, a formatter, a codemod, git checkout -- file), the bash result shows only the command's output. The agent and the reviewer cannot see what changed without running git diff separately, and changes outside Git or to ignored files are not visible at all. Edits made through edit, write and apply_patch already report a diff.

Checked on main (92084f102): no bash option or result field reports changed files. The bash config keys are enabled, env, rewrite, compress, background, subagent_background, foreground_wait_window_ms, powershell_tool, detach_on_user_message, db_schema_hints, watch_sync_max_ms, worker_wait_max_ms and linux_scope.

Prior art: Claude Code 2.1.269 added a diff of the files a Bash command changed to the Bash tool result (setting bashEditDiffEnabled).

Proposal

An opt-in bash.changed_files setting (off / list / diff):

  • Track files in the project that change between the start and the end of a foreground command. AFT's file watcher already sees these events, so a full rescan should not be needed.
  • list: append the changed, added and deleted paths to the result.
  • diff: append a capped unified diff, with the same caps and truncation trailer as other list-shaped results, and skip binary and very large files.
  • For a promoted or background command, report the changes once, in the completion notice.
  • Optionally record an undo snapshot for files that a shell command changed, so aft_safety undo covers shell edits as it covers edit. This needs a before-image; a first version can do without it.

iceteaSA avatar Oct 22 '26 17:10 iceteaSA

This shipped in v0.63.4 and is included in v0.64.0. Set bash.changed_files to "list" or "diff" in user configuration; it is off by default. Foreground results and background completion notices include the report, with caps and incompleteness warnings. It uses watcher coverage, so ignored paths are excluded, and it does not add shell undo. Please reopen if the supported reporting still fails on v0.64.0.

aft-alfonso[bot] avatar Nov 11 '26 19:11 aft-alfonso[bot]