Skip to content

feat(cli): orca file open --line and --column put the cursor there - #26137

Closed
maketryuk wants to merge 2 commits into
stablyai:mainfrom
maketryuk:feat/file-open-line-column
Closed

maketryuk wants to merge 2 commits into
stablyai:mainfrom
maketryuk:feat/file-open-line-column

Conversation

@maketryuk

@maketryuk maketryuk commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

orca file open could only open a file at its top. Now --line and --column put the cursor exactly where you point, the way clicking a search result does.

What Changed

Before: orca file open src/App.tsx opened the tab with the cursor on line 1; nothing could ask for a spot.
After: orca file open src/App.tsx --line 42 --column 7 opens the tab scrolled to line 42 with the cursor on column 7. Without --line, nothing changes.

Mechanism:

  • RPC — files.open takes optional 1-based line and column. files.openDiff is unchanged.
  • Host — openMobileFile → openFile → the window notifier forward a position, added to ui:openFileFromMobile only when present.
  • Renderer — the runtime file-open bridge opens the tab exactly as before, then calls scheduleEditorLineReveal with the new tab's file id: the same landing Quick Open's path:line uses. A Markdown file switches to source view first, as Quick Open does.
  • CLI — --line and --column, validated before any RPC (--column without --line is 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 scheduleEditorLineReveal keeps 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:

Before — orca file open <file> After — orca file open <file> --line 300 --column 7
opens at line 1 cursor on line 300, column 7

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Not tested by hand in a visible window; the e2e below drives the real app headless.

  • E2E tests/e2e/cli-file-open-position.spec.ts: opens a 400-line file through the dev CLI; the Monaco cursor is 1:1 without --line and 300:7 with it, and line 300 is in view.
  • Unit: CLI (flags sent; --column alone, 0, 4.5 and 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).
  • Compatibility: the new CLI against an installed 1.4.220 host — it strips the fields and opens the file (ok: true).
  • Ran locally (macOS): pnpm typecheck, repo-wide oxlint, check:code-quality:changed, check:max-lines-ratchet, verify:rpc-params-catalog, and pnpm test:node over src/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 full pnpm lint, pnpm test and pnpm build.

AI Disclosure

Prepared with Claude (Opus 5.5) in Claude Code at the author's request.

Review

AI code review summary:

  • Cross-platform — positions are plain integers; no paths are built; CLI parsing reuses getOptionalPositiveIntegerFlag.
  • SSH / remote — the position rides the existing RPC → host → window path, so SSH worktrees behave the same. Paired clients are not navigated, as before.
  • Wire compatibility — new optional RPC fields only (per docs/reference/remote-wire-compatibility.md). Older hosts strip them; a call without a line makes the same runtime call as before.
  • Mobile — phones never send the fields; unchanged.
  • Agents and integrations — provider-neutral.
  • Performance — two animation frames, only when a position is asked for.
  • Security — line/column are 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

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and 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

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

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
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 06c6d955-69f9-46a0-8e58-296586aa97fa
📥 Commits

Reviewing files that changed from the base of the PR and between 25eb336 and cbee1cb.

📒 Files selected for processing (3)
  • src/cli/handlers/file-open-position.ts
  • src/cli/handlers/file.test.ts
  • src/cli/handlers/file.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

orca file open now accepts optional 1-based --line and --column values. The CLI validates the values and includes them in the files.open request. The runtime forwards the position through the mobile file-open event. The renderer opens the file and reveals the requested cursor location; positioned Markdown files switch to source view.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to cbee1

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 23 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #26136 requires optional 1-based line and column positioning for orca file open, forwarding through files.open and the host, then revealing the position with scheduleEditorLineReveal. The …
Out of Scope Changes check ✅ Passed The CLI help, command specification, and reference documentation describe the new positioning options. The shared position type, RPC and IPC forwarding, and tests support the implementation of issue #…
Title check ✅ Passed The title clearly summarizes the main change: adding --line and --column options to orca file open to position the cursor.
Description check ✅ Passed The description covers the required sections with a clear user-facing explanation, implementation details, rationale, linked issue, visual proof, testing, AI disclosure, review notes, and completed ch…
  • Fix all pre-merge checks with AI
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5ed955cd-0ca5-4119-bec1-0b92aff935ea
📥 Commits

Reviewing files that changed from the base of the PR and between 385fe8a and 25eb336.

📒 Files selected for processing (23)
  • docs/site/content/docs/cli/reference.mdx
  • src/cli/command-scoped-flag-help.ts
  • src/cli/handlers/file.test.ts
  • src/cli/handlers/file.ts
  • src/cli/root-help-text-secondary.ts
  • src/cli/specs/file.ts
  • src/main/runtime/orca-runtime-file-commands.ts
  • src/main/runtime/orca-runtime-files-mobile-explorer-reads.test.ts
  • src/main/runtime/rpc/methods/files-open-navigation.test.ts
  • src/main/runtime/rpc/methods/files.ts
  • src/main/runtime/runtime-file-command-host.ts
  • src/main/runtime/runtime-file-commands-constructor.ts
  • src/main/runtime/runtime-notifier-contract.ts
  • src/main/window/runtime-window-lifecycle-file-open.test.ts
  • src/main/window/runtime-window-lifecycle.ts
  • src/preload/api/ui-bridge-terminal-and-session-tabs.ts
  • src/preload/api/ui-command-event-api.ts
  • src/renderer/src/hooks/ipc-events/mobile-terminal-close-ipc-bridge.test.ts
  • src/renderer/src/hooks/ipc-events/mobile-terminal-close-ipc-bridge.ts
  • src/shared/rpc-contract/files-params.ts
  • src/shared/runtime-file-contracts.ts
  • src/shared/runtime-types.ts
  • tests/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.

Comment thread src/cli/handlers/file.ts Resolved
…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.
@nwparker

Copy link
Copy Markdown
Contributor

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.

@nwparker nwparker closed this Oct 14, 2026
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.

[Feature]: orca file open at a line and column

2 participants