Skip to content

Align apply_patch results with Codex and support SSH backends#29

Open
AMagicPear wants to merge 3 commits into
code-yeongyu:mainfrom
AMagicPear:codex-apply-patch-alignment
Open

Align apply_patch results with Codex and support SSH backends#29
AMagicPear wants to merge 3 commits into
code-yeongyu:mainfrom
AMagicPear:codex-apply-patch-alignment

Conversation

@AMagicPear

@AMagicPear AMagicPear commented Jul 15, 2026

Copy link
Copy Markdown

Summary

This PR brings the extension's apply_patch result handling closer to Codex while preserving the repository's existing src/ layout.

Changes

  • Persist final file changes as compact Codex-style hunks-only unified diffs.
  • Keep final details.changes available for TUI expansion/collapse, including Ctrl+O re-rendering.
  • Keep streaming preview behavior separate from the compact final result.
  • Add injectable filesystem operations so SSH sessions apply patches through the remote filesystem backend.
  • Wire the SSH backend through the pi event bus to avoid a direct extension dependency.
  • Add support for add, delete, update, move, fuzz, partial failure, and progress details.
  • Add a root index.ts loader entry while preserving the main implementation under src/, so pi displays the real extension directory name instead of src.
  • Keep standard GPT providers as the default and allow private provider IDs through the local ~/.pi/agent/pi-apply-patch.json configuration file without committing user-specific providers.

Issue coverage

Closes #23
Closes #16

Verification

  • npm run check
  • npm test (55/55)
  • git diff --check
  • Real pi loader smoke test with pi -e ./index.ts --no-session --mode json --offline
  • Remote filesystem backend test

The local provider configuration is intentionally outside the repository and is not included in this PR.

@AMagicPear
AMagicPear requested a review from code-yeongyu as a code owner July 15, 2026 05:31
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.

Final apply_patch result should keep diff preview after completion Diff just disappears

1 participant