feat(extensions): add app handoff for bundled editor - #943
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThe PR moves the existing open-in-editor workflow behind a new version-16 extension workspace capability while retaining host ownership of path resolution, process execution, terminal lifecycle, and review refreshes.
Confidence Score: 4/5The PR appears safe to merge, with only a non-blocking test-maintainability issue around direct environment mutation. The bundled command remains aligned with the existing command catalog and receives current, lease-guarded workspace controls; editor execution and reload eligibility remain host-owned, and no blocking behavioral or security failure was established. Files Needing Attention: src/ui/hooks/useExtensionWorkspaceControls.test.tsx Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User
participant C as Shared command catalog
participant E as Bundled editor extension
participant W as Workspace capability
participant H as Host editor lifecycle
participant R as Review refresh
U->>C: Press e / choose File menu action
C->>E: Run hunk.review.editSelectedFile
E->>W: openInEditor(fileId, hunkIndex, line)
W->>W: Validate lease, reviewed file, and source address
W->>H: Resolve path and mapped line
H->>H: Suspend terminal and spawn configured editor
H->>H: Resume terminal
alt Editor succeeds and input is reloadable
W->>R: Queue reconciliation
W-->>E: "{ ok: true }"
else Request unavailable or editor fails
W-->>E: "{ ok: false, reason, detail }"
E-->>U: Attributed notification
end
Prompt To Fix All With AI### Issue 1
src/ui/hooks/useExtensionWorkspaceControls.test.tsx:24
**Direct environment mutation**
The new editor-control tests read and mutate `process.env.EDITOR` directly in setup, cleanup, and individual cases. This bypasses the repository’s required environment-access pattern and adds global mutable state that makes test isolation and future environment validation harder to maintain.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "feat(extensions): move editor workflow i..." | Re-trigger Greptile |
| } as const; | ||
| const WRITABLE_INPUT: CliInput = { kind: "vcs", staged: false, options: {} }; | ||
| const tempDirs: string[] = []; | ||
| const originalEditor = process.env.EDITOR; |
There was a problem hiding this comment.
The new editor-control tests read and mutate process.env.EDITOR directly in setup, cleanup, and individual cases. This bypasses the repository’s required environment-access pattern and adds global mutable state that makes test isolation and future environment validation harder to maintain.
Context Used: guidelines.mdc Cursor rule (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/ui/hooks/useExtensionWorkspaceControls.test.tsx
Line: 24
Comment:
**Direct environment mutation**
The new editor-control tests read and mutate `process.env.EDITOR` directly in setup, cleanup, and individual cases. This bypasses the repository’s required environment-access pattern and adds global mutable state that makes test isolation and future environment validation harder to maintain.
**Context Used:** guidelines.mdc Cursor rule ([source](https://github.com/modem-dev/modem/blob/main/.cursor/rules/guidelines.mdc))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
ctx.openInApp(callback)terminal handoff andctx.workspace.resolveLocation(...)source metadata translation to extension commandshunk.review.editSelectedFileworkflow through a bundled extension that owns editor selection, arguments, asynchronous process execution, exit handling, and refreshWhy
Opening an editor is one instance of a broader extension workflow: trusted extensions may launch editors, debuggers, browsers, or other terminal applications. Hunk now owns only renderer suspension and restoration while the extension owns application-specific execution and metadata.
The bundled editor exercises that same public contract. Terminal editors run inside
openInApp; Code-family GUI editors remain visible and receive--waitso Hunk refreshes after editing completes.Lifecycle guarantees
finallyafter callback success or failureVerification
bun run typecheckbun run lintbun run format:checkbun run deps:checkbun run check:docsbun run check:packbun run changeset:statusbun run test(3,639 passed, 12 skipped)bun run test:integration(140 passed, 1 skipped), including real child-process terminal handoff and restorationbun run test:tty-smoke(9 passed)Visual evidence
No intended visual change. The existing
eshortcut and File-menu action retain their behavior; failures travel through the bundled extension notification surface.Platform notes
Tested on Linux. Cross-platform command construction covers quoted Windows executable paths and shell-free arguments.