Replies: 6 comments 3 replies
|
I am highly supporting this for plugins - use cases are for example running a reviewer on space / agent or creating new wt from a gh PR. |
|
Quick technical feasibility pass against the current codebase: yes, this is very doable, and it composes cleanly off three things that already exist. 1. Plugin action invocation already exists. 2. The invocation context already carries the worktree. 3. The right-click context menu already exists. What would actually have to change:
One design suggestion: the proposed No architectural changes, no runtime/client boundary concerns (menu = TUI presentation; action dispatch reuses the existing server invocation path). It's roughly one small refactor + six small additions, all following patterns already in the codebase. |
|
Strong +1. A concrete use case beyond copy-path: a "Mark for review / unread" toggle on agent/workspace rows. I've prototyped it at the shell level with |
|
Adding the missing half of @tdi's feasibility pass. He's right that invocation already works — the gap is on the render side, and it's structural. The manifest contract is already shipped, and it's inert. // src/api/schema/plugins.rs:355
pub enum PluginActionContext { Global, Workspace, Tab, Pane, Selection }That's one variant per context menu herdr has, plus selection. But So a plugin author writes Why no plugin can work around it. Every menu is a compile-time array: // src/app/state.rs
pub fn items(&self) -> &'static [&'static str] {
ContextMenuKind::Tab { .. } => &["New tab", "Rename", "Close"],
Minimal shape of a fix: have Demand is fragmented, which is probably why this reads smaller than it is: #1272, #1512, #1672, #1722, Q&A #1527 here, plus issues #1511, #1671, #1776, #1830 auto-closed to discussions. I have this working locally on a v0.8.0 fork — menus built at runtime, entries dispatching through the API path. Happy to open a PR against the real design if a maintainer wants it; I'd rather match your intended shape than guess. |
|
+1, from a plugin user angle rather than a plugin-author one. My case is deliberately boring: git pull / git push on the workspace row. One space per repo, the row already shows me the branch and that I'm ahead, and that row is exactly where my mouse already is. Right-click → Git pull is the whole feature. What I have instead today is a plugin with a keybinding that opens a small pull/push/fetch picker in a pane. It works, but it acts on the focused workspace rather than the one I clicked, so I first focus the row, then recall the key. The mouse path is the natural one here and it's the only one that isn't available. The manifest side already reads like it anticipates this — my actions declare |
|
+1. Same use case as @jeffreyhaen: one space per repo, and I'd like "Git pull" on the workspace right-click menu. |
Uh oh!
There was an error while loading. Please reload this page.
idea / problem
When I right-click a worktree entry in the sidebar I get a fixed, hard-coded menu: Rename, Close, Delete worktree checkout. There is no way for a plugin to add entries to that menu.
As a plugin author building worktree management tooling I need a contextual surface to offer actions like "Copy worktree path". The checkout path is already known to Herdr (it places it under
<worktrees.directory>/<repo>/<branch-slug>) but there is no way to surface it to my clipboard today without leaving Herdr or asking users to memorise an arbitrary keybinding.Keybindings are the only current plugin trigger surface, but they are not discoverable, and they do not carry the clicked workspace/worktree as implicit context. A right-click on the exact entry a user is looking at is the natural place to offer workspace-scoped plugin actions.
requested change
Add a
[[context_menu_items]]table toherdr-plugin.tomlthat lets plugins declare entries injected into the sidebar right-click menus for workspaces and worktrees.Each item declares a label, which surface(s) it targets, and the action id to invoke. When the user clicks the item Herdr invokes the action exactly as it would for a keybinding-triggered action, and injects the same invocation context it already provides (
workspace id,worktree path,branch name) as environment variables so the plugin command can act on what was right-clicked without any additional socket round-trips.Minimal manifest sketch:
The corresponding action entry stays unchanged. The plugin receives
HERDR_WORKTREE_PATH(or equivalent) and can write to the clipboard via the OS, call back throughHERDR_BIN_PATH, or do anything else a normal plugin action already can.why you want this
The immediate use case is a "Copy worktree path" menu item for a worktree management plugin. One click, path on the clipboard. No keybinding to remember, no pane to open.
But the same mechanism unlocks a whole class of contextual worktree actions: running post-checkout setup scripts on a freshly created worktree, offering a teardown flow that goes beyond "Delete worktree checkout", or opening the path in another tool. All of these are naturally right-click actions because the user is already looking at the worktree entry when they want to act on it.
Context menus are the right UX here because they are discoverable (users find them by right-clicking, not by reading docs), contextual (the clicked item is the implicit target), and composable (multiple installed plugins can each contribute entries without conflicting). Keybindings are a poor substitute for this pattern.
All reactions