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
@code-yeongyu

Copy link
Copy Markdown
Owner

Thanks for this PR. I have merged the non-SSH parts it overlaps with via separate PRs:

I am excluding the SSH filesystem backend from this round: it introduces an injectable filesystem-operations layer wired through the pi event bus, which is a meaningful architectural addition I want to evaluate separately rather than merge bundled with the result-formatting changes.

If you would like the SSH backend to land, please split it into a standalone PR with just the injectable filesystem operations + event-bus wiring + SSH tests, and I will review it on its own merits. The root index.ts loader entry and bun.lock changes can come with it.

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.

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

2 participants