This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

tools.herd: add --focus, resolve workspace from the current pane

+21 -6
+19 -6
tools/herd/flake-module.nix
··· 7 7 # s herd 'fix issue #13' --model opus 8 8 # Everything is passed through to omp, so any omp flag works. The tab 9 9 # lands in the focused workspace (one is created from $PWD if there is 10 - # none) and is not focused, so the caller's pane stays put. herdr picks 11 - # the agent up by itself; name it with `herdr agent rename <pane> <name>` 12 - # if you want to address it by name afterwards. 10 + # none). By default it is not focused, so the caller's pane stays put; 11 + # `-f`/`--focus` (before the prompt) switches to the new pane instead. 12 + # herdr picks the agent up by itself; name it with 13 + # `herdr agent rename <pane> <name>` if you want to address it by name 14 + # afterwards. 13 15 packages.herd = 14 16 (pkgs.writeShellApplication { 15 17 name = "herd"; ··· 18 20 pkgs.jq 19 21 ]; 20 22 text = '' 21 - workspace=''${HERDR_WORKSPACE_ID:-$(herdr workspace list | jq -r '.result.workspaces[] | select(.focused) | .workspace_id')} 23 + focus=--no-focus 24 + case "''${1:-}" in 25 + -f|--focus) 26 + focus=--focus 27 + shift 28 + ;; 29 + esac 30 + # Not $HERDR_WORKSPACE_ID: that is the launch-time value and goes 31 + # stale once the pane is moved to another workspace (herdr keeps 32 + # the old pane id as an alias, so `pane current` still resolves). 33 + workspace=$(herdr pane current 2>/dev/null | jq -r '.result.pane.workspace_id // empty') 34 + [ -n "$workspace" ] || workspace=$(herdr workspace list | jq -r '.result.workspaces[] | select(.focused) | .workspace_id') 22 35 label=$(printf '%s' "''${1:-omp}" | cut -c1-32) 23 36 if [ -n "$workspace" ]; then 24 - created=$(herdr tab create --workspace "$workspace" --cwd "$PWD" --label "$label" --no-focus) 37 + created=$(herdr tab create --workspace "$workspace" --cwd "$PWD" --label "$label" "$focus") 25 38 else 26 - created=$(herdr workspace create --cwd "$PWD" --label "$(basename "$PWD")" --no-focus) 39 + created=$(herdr workspace create --cwd "$PWD" --label "$(basename "$PWD")" "$focus") 27 40 fi 28 41 pane=$(printf '%s' "$created" | jq -er .result.root_pane.pane_id) 29 42 herdr pane run "$pane" "s llm.omp$(printf ' %q' "$@")" >/dev/null
+2
tools/herd/usage.kdl
··· 1 1 bin "herd" 2 2 about "Start an omp agent in a new herdr tab (current workspace, current directory) and print its pane id" 3 3 4 + flag "-f --focus" help="Switch to the new pane instead of staying in the current one (must come before the prompt)" 5 + 4 6 arg "[prompt]" help="First message for omp" 5 7 arg "[omp-args...]" help="Arguments passed through to omp, e.g. --model opus"