Skip to content

feat(source-control): add copy relative path#9018

Open
kenfdev wants to merge 1 commit into
stablyai:mainfrom
kenfdev:feat/source-control-copy-relative-path
Open

feat(source-control): add copy relative path#9018
kenfdev wants to merge 1 commit into
stablyai:mainfrom
kenfdev:feat/source-control-copy-relative-path

Conversation

@kenfdev

@kenfdev kenfdev commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds “Copy Relative Path” to the Source Control file context menu, directly below the existing “Copy Path” command.

The command copies the path of the row whose context menu was opened, relative to the worktree root. It intentionally preserves the existing single-row behavior of “Copy Path” and does not change multi-selection behavior.

Closes #9017

Screenshots

SCR-20260716-qrxm

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

The full test suite completed with 29,963 passing tests, 42 skipped tests, and two failures unrelated to this change:

  • The orchestration keepalive timing test failed during the full run but passed when rerun in isolation.
  • The zsh path-lookup test consistently resolves the Homebrew mise executable instead of the current mise-managed Node executable in this local environment.

The focused Source Control context-menu regression test passes.

AI Review Report

The AI coding agent reviewed the implementation and regression test for:

  • Consistency with the existing “Copy Path” behavior
  • Correct placement and labeling of the new context-menu command
  • Correct wiring for both uncommitted-change and branch-comparison rows
  • Accidental changes to Source Control multi-selection behavior
  • Reuse of existing context-menu primitives, icons, translations, and clipboard IPC
  • SSH and cross-platform path behavior

The review confirmed that the command copies the existing Git-relative entry.path without local filesystem conversion. This keeps the behavior consistent across macOS, Linux, Windows, WSL, and SSH environments.

A standalone React Doctor scan reported existing diagnostics in the large SourceControl.tsx component. None related to this change; the repository’s changed-file React Doctor gate passed. No implementation changes were required as a result.

The review explicitly checked cross-platform compatibility. This PR does not add or change keyboard shortcuts, shortcut labels, shell commands, filesystem operations, or Electron platform-specific behavior. It only passes an existing Git-relative path string to the existing clipboard API.

Security Audit

The AI coding agent reviewed the change for input handling, command execution, path handling, authentication, secrets, dependencies, and IPC risks.

  • The relative path originates from existing Git status data.
  • The value is copied to the clipboard only after an explicit user action.
  • The path is not executed, resolved, parsed, or passed to a shell.
  • No filesystem access, authentication, secrets, or permissions are involved.
  • No dependencies were added or changed.
  • No new IPC surface was introduced; the implementation reuses the existing window.api.ui.writeClipboardText API already used by “Copy Path.”

No security follow-up is needed.

Notes

  • The command intentionally copies only the row whose context menu was opened, matching the existing “Copy Path” behavior.
  • Multi-selection behavior is unchanged.
  • Relative paths come directly from Git status data, so the feature does not depend on local path separators and works for remote SSH worktrees.
  • No shortcuts, shell behavior, or Electron platform-specific behavior were changed.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e093921c-e521-42d2-90e6-6552f6f5f944

📥 Commits

Reviewing files that changed from the base of the PR and between 377082e and ea39bdb.

📒 Files selected for processing (3)
  • src/renderer/src/components/right-sidebar/SourceControl.tsx
  • src/renderer/src/components/right-sidebar/source-control-entry-context-menu.test.tsx
  • src/renderer/src/components/right-sidebar/source-control-entry-context-menu.tsx

📝 Walkthrough

Walkthrough

The source control context menu now accepts an optional relative path and adds a “Copy Relative Path” action that writes it to the clipboard when available. Both uncommitted and branch entries pass their relative paths to the menu. A new test suite verifies that selecting the action copies the expected path.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly names the main user-facing change and is concise.
Description check ✅ Passed The description includes the required sections and covers summary, screenshots, testing, AI review, security, and notes.
Linked Issues check ✅ Passed The PR implements the linked feature and matches the required placement and behavior for copying a relative path.
Out of Scope Changes check ✅ Passed The changed files are all directly related to the new relative-path context-menu action and its regression test.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

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]: Add “Copy Relative Path” to Source Control file context menu

2 participants