Repository navigation
feat(cli): open files at a requested line and column - #28240
Conversation
Forward optional 1-based positions through the existing file-open command. Defer background positioning until the editor is selected and guard delayed reveals against navigation, teardown, and split-pane focus changes. Fixes #26136 Co-authored-by: Nikita Maketryuk <[email protected]>
The directory classifier joins paths with node:path, so Windows stat calls use backslashes. Match that existing behavior in the symlink setting and no-follow assertions.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to
|
Restore the existing header to the first line so TypeScript and the directive ratchet recognize it. The position type import and runtime behavior are unchanged.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
456c96c3-7679-4bb8-a3e7-9f0b708eb507
📒 Files selected for processing (34)
docs/site/content/docs/cli/reference.mdxsrc/cli/command-scoped-flag-help.tssrc/cli/handlers/file-open-position.tssrc/cli/handlers/file.test.tssrc/cli/handlers/file.tssrc/cli/root-help-text-secondary.tssrc/cli/specs/file.tssrc/main/runtime/orca-runtime-file-commands.tssrc/main/runtime/orca-runtime-files-mobile-explorer-reads.test.tssrc/main/runtime/rpc/methods/files-open-navigation.test.tssrc/main/runtime/rpc/methods/files.tssrc/main/runtime/runtime-file-command-access.tssrc/main/runtime/runtime-file-command-host.tssrc/main/runtime/runtime-notifier-contract.tssrc/main/window/runtime-window-lifecycle-file-open.test.tssrc/main/window/runtime-window-lifecycle.tssrc/preload/api/ui-bridge-terminal-and-session-tabs.tssrc/preload/api/ui-command-event-api.tssrc/renderer/src/components/editor/EditorEditFileSurface.tsxsrc/renderer/src/components/editor/MonacoEditor.tsxsrc/renderer/src/components/editor/monaco-editor-mount-params.tssrc/renderer/src/components/editor/monaco-view-state-persistence.test.tssrc/renderer/src/components/editor/monaco-view-state-persistence.tssrc/renderer/src/components/editor/use-monaco-editor-mount.tssrc/renderer/src/components/editor/use-monaco-reveal-scheduler.test.tsxsrc/renderer/src/components/editor/use-monaco-reveal-scheduler.tssrc/renderer/src/hooks/ipc-events/mobile-terminal-close-ipc-bridge.test.tssrc/renderer/src/hooks/ipc-events/mobile-terminal-close-ipc-bridge.tssrc/renderer/src/hooks/ipc-events/runtime-file-position.tssrc/renderer/src/store/slices/editor/focus/editor-focus-reveal.tssrc/renderer/src/store/slices/editor/types/pending-editor-reveal.tssrc/shared/rpc-contract/files-params.tssrc/shared/runtime-file-contracts.tstests/e2e/cli-file-open-position.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f69e0707-6c1f-45ab-b04e-6fa979de0ec0
📒 Files selected for processing: 1
src/renderer/src/hooks/ipc-events/mobile-terminal-close-ipc-bridge.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
…/scan-cli-file-position
…/scan-cli-file-position # Conflicts: # src/main/orcad/orcad-entry.ts
…/scan-cli-file-position
…/scan-cli-file-position # Conflicts: # src/main/native-chat/agent-session-wire/structured-agent-session-message-options.ts
…/scan-cli-file-position
…/scan-cli-file-position
…working on upstream's new layout Restore the background terminal launcher upstream deleted (stablyai#28130) as a fork copy for review workspaces, point the PR comment scope at the moved git identity helper, and record in FORK.md that upstream's own --line/--column (stablyai#28240) retired the fork's.
ELI5
Tools can now tell Orca which line and column to show, so you can go straight to an error or search result.
What Changed
orca file open a.ts --line 42 --column 7 --focusopens the file at that cursor position. Without--focus, Orca preserves the visible file and caret, then applies the position when you activate the target tab. Markdown opens in source view when the position is applied. A later successful open without a position cancels that file’s earlier queued position.Optional position fields travel through the existing file-open request and editor reveal scheduler. The queue follows the target file’s ordinary or floating workspace and selected pane; delayed callbacks check that the request still owns that editor before moving its cursor. Invalid positions fail before opening anything; valid positions beyond the document clamp to its end.
Why
Reusing the existing reveal scheduler keeps mounting, delayed content and line clamping consistent. A separate reveal command would add a round trip and could race file loading.
Linked Issue
Fixes #26136
Visual Proof
Captured from hidden Electron renderers using the real built CLI. The initial positioning flow passed three consecutive runs; the latest rebuilt flow also covers cancellation and split panes.
The selected split pane moves while its sibling keeps its cursor:
The floating editor clamps an oversized position to line 400/end while the main editor stays at line 1. This image predates the final plain-open cancellation fix; the floating behavior was rechecked on the final head.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Positioning and cancellation: 65 focused tests pass on the positioning fix. All five new cancellation regressions fail before and pass after it. Rebuilt hidden CLI/Monaco and floating-editor flows check cancellation, split isolation, focus departure, bounds and empty files; independent actual CLI verification is clean. All 40 feature and proof files are byte-identical on the resolved head.
Bounds and compatibility: 57 actual CLI/RPC/editor checks cover zero, negative, fractional, unsafe, missing and column-only values, oversized valid positions and empty files at 1:1. Older-client requests and the pre-feature schema contract pass. Earlier feature verification passed 168 focused tests on each macOS, Linux and Windows execution host.
Hidden rendering and cleanup: floating-position and hover-card tests pass on macOS and isolated Linux using the existing CDP capture pattern. Native windows remain hidden and unfocused; position, focus and timeout assertions remain. Lifecycle tests verify all four subscriptions and both DOM listeners are removed on unmount.
Final integration,
a9c4c67: current main is preserved, including its clock callback, real session-store fixture and catalog corrections. These upstream repairs do not remain in the PR diff. The final diff is the original 40 feature files plus the saved-timestamp/restart regression. Actual Node 24 tests pass 12/12 for local/SSH template titles and colors and permission timestamps; the five tab tests also pass under Bun. Full Node typecheck and catalog validation pass. Independent review checks exactly one clock field and audits the completed typecheck against the frozen source. Formatting and commit hooks pass; the original assertions are unchanged.CI: all 28 checks passed before the subsequent main integrations. All 28 CI checks passed on this exact reviewed commit before merge, including all five Node 24 shards, both rendered end-to-end suites, full lint/typecheck/catalog validation, compatibility, packaging and native smoke checks. On the heavily loaded local host, broader runs and a later isolated Node 24 run timed out during initial module loading. Broad local lint was canceled. Those local results are not claimed as passing; no timeout or assertion was weakened.
Limits: a released older binary and native Windows UI were not launched. Full E2E typecheck has unrelated baseline/cloud dependency errors. Rendered proof is from hidden macOS and isolated Linux sessions.
Review
Reviewed community PR #26137 and credited Nikita Maketryuk
<[email protected]>as co-author in the feature commit. Independent review covered delayed reveals, split panes, floating workspaces, cleanup, owner isolation and later plain opens. Both review threads are resolved with reproduction evidence or the tested background-open contract.Agent skill upstream boundary
Notes
Merge risk: low based on independent review, with all final CI passed. No negative trade-offs identified for existing behavior. Optional fields preserve mixed-version requests: older hosts still open files but ignore positioning. Positions are session-local. Existing path validation, execution-host ownership and focus defaults remain unchanged.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (covered by final CI; local limits described above)