Skip to content

fix: add file cycling in multi-file permission prompt#23262

Open
nitishagar wants to merge 1 commit intoanomalyco:devfrom
nitishagar:contrib/issue-21914
Open

fix: add file cycling in multi-file permission prompt#23262
nitishagar wants to merge 1 commit intoanomalyco:devfrom
nitishagar:contrib/issue-21914

Conversation

@nitishagar
Copy link
Copy Markdown

Issue for this PR

Closes #21914

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When apply_patch edits multiple files, the permission prompt concatenates all diffs into one blob with no way to review individual files. The per-file data (metadata.files[]) was already being sent by apply_patch but the EditBody component ignored it, only reading the concatenated metadata.diff string.

This adds [ and ] keybinds to cycle through files one at a time in the permission prompt:

  • Extracts the files array from metadata.files in EditBody
  • When multiple files are present, shows one file's diff at a time with a file indicator bar ("Patched src/foo.ts 2/5")
  • ] cycles to the next file, [ cycles to the previous, with wrap-around
  • Adds a [ ] files hint in the prompt footer when in multi-file mode
  • Single-file edits are unchanged (no files array present, falls through to existing behavior)

How did you verify your code works?

  • Ran bun run typecheck — no new type errors (only pre-existing TS7006 from unresolved @opentui/solid types)
  • Verified single-file edit path is unchanged (no files array → existing concatenated diff behavior)
  • Reviewed that [/] keyboard handling follows the same pattern as existing cycling keybinds (agent_cycle, session_child_cycle)

Screenshots / recordings

N/A — TUI change, needs manual testing with "edit": "ask" permission config and a multi-file edit prompt.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No way to navigate between individual file diffs in the permission prompt for multi-file edits

1 participant