Repository navigation
Conversation
A tool that knows where something is in a file (an error, a search hit, a TODO) could open the file but not land on the spot. files.open now takes optional 1-based line and column; the host forwards them to its window, which opens the tab as before and reveals the position through scheduleEditorLineReveal, the path Quick Open's `path:line` takes. A Markdown file switches to source view first, as Quick Open does. Both fields are optional, so an older host strips them and opens at the top instead of failing, and a call without a line is unchanged. Fixes stablyai#26136
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to Empty cursor flags are now rejected rather than silently opening the file at the top. No remaining merge-blocking risk is established by this review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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:
5ed955cd-0ca5-4119-bec1-0b92aff935ea
📒 Files selected for processing (23)
docs/site/content/docs/cli/reference.mdxsrc/cli/command-scoped-flag-help.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-host.tssrc/main/runtime/runtime-file-commands-constructor.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/hooks/ipc-events/mobile-terminal-close-ipc-bridge.test.tssrc/renderer/src/hooks/ipc-events/mobile-terminal-close-ipc-bridge.tssrc/shared/rpc-contract/files-params.tssrc/shared/runtime-file-contracts.tssrc/shared/runtime-types.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; 9 remain after this review.
…the top The number parser reads `--line=` as an absent flag, so the file opened at its top and the command reported success. An empty value is now a missing value, as it already is for --mode. The position parsing moves to its own module to keep file.ts under its line limit.
|
Superseded by merged PR #28240, which adds line and column targeting with bounds validation and preserves background, split-pane, and floating-editor behavior. Nikita Maketryuk is credited as co-author in the actual squash commit b428def; both the commit trailer and GitHub author metadata were verified after merge. Closing this fully superseded PR now that the replacement is merged and all CI checks passed. |
ELI5
orca file opencould only open a file at its top. Now--lineand--columnput the cursor exactly where you point, the way clicking a search result does.What Changed
Before:
orca file open src/App.tsxopened the tab with the cursor on line 1; nothing could ask for a spot.After:
orca file open src/App.tsx --line 42 --column 7opens the tab scrolled to line 42 with the cursor on column 7. Without--line, nothing changes.Mechanism:
files.opentakes optional 1-basedlineandcolumn.files.openDiffis unchanged.openMobileFile→openFile→ the window notifier forward aposition, added toui:openFileFromMobileonly when present.scheduleEditorLineRevealwith the new tab's file id: the same landing Quick Open'spath:lineuses. A Markdown file switches to source view first, as Quick Open does.--lineand--column, validated before any RPC (--columnwithout--lineis refused), plus help, spec notes and the CLI reference page.Why
Agents and tools usually already know the position — a compiler error, a search hit, a TODO comment — and today the user has to find it again by hand. Reusing
scheduleEditorLineRevealkeeps one landing path for every "open at a line" in Orca. Alternatives considered: a separate reveal RPC after the open (two round trips, and it races the tab's Monaco mount), opening an external editor at the line (leaves Orca), sending Go to Line keystrokes (fragile, can type into the wrong pane).Linked Issue
Fixes #26136
Visual Proof
Captured by the new e2e spec on a hidden renderer (
electron-headless, no window shown), same 400-line file:orca file open <file>orca file open <file> --line 300 --column 7Testing
Not tested by hand in a visible window; the e2e below drives the real app headless.
tests/e2e/cli-file-open-position.spec.ts: opens a 400-line file through the dev CLI; the Monaco cursor is 1:1 without--lineand 300:7 with it, and line 300 is in view.--columnalone,0,4.5and non-numbers refused before any RPC), RPC (position passed; a lone column ignored;0,-1,1.5,"12"rejected), runtime and window forwarding (position sent, and omitted when absent), renderer bridge (reveal lands after the remount frames with the tab's file id, column defaults to 1, Markdown opens in source view, no reveal without a position).ok: true).pnpm typecheck, repo-wideoxlint,check:code-quality:changed,check:max-lines-ratchet,verify:rpc-params-catalog, andpnpm test:nodeoversrc/cli,src/main/runtime/rpc,src/main/window,src/renderer/src/hooks,src/shared,src/preload(1756 files, 19009 tests) — all green. Not run locally: the fullpnpm lint,pnpm testandpnpm build.AI Disclosure
Prepared with Claude (Opus 5.5) in Claude Code at the author's request.
Review
AI code review summary:
getOptionalPositiveIntegerFlag.docs/reference/remote-wire-compatibility.md). Older hosts strip them; a call without a line makes the same runtime call as before.line/columnare validated as positive integers in both the CLI and the RPC schema; no new file access, and the path check is unchanged.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)