hiiro 0.1.384 → 0.1.385

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 308d4ea2a261c3dd45eedd5b40bb0bcf8ada1b6cd2310bd908abac4e4d73c408
4
- data.tar.gz: e138d7b8aeed4b9fa598dbe8d0d7dfb45abec78658c338a048d42d8d540a3a27
3
+ metadata.gz: 1877449a8336392c36f54f38f1ea86792b736f6d8af25bea8bb98f1f62081328
4
+ data.tar.gz: 495465e2395a43cc24464922aa60e24283e97bf715f7492f7be182e8936629c6
5
5
  SHA512:
6
- metadata.gz: 9d0e4d5ab790f5c262d7d4c03517c7caf40214ad9e9e2b76e7df84724bdf19f105eff32c935bcdea3f73cc64ec3bdf5e922258ffed5c44cdd9969b2649e313b7
7
- data.tar.gz: 74a0868f58e19659707345d4241f08ae0c112f2e925b2c5fe43e6faf008b7eceafdcc914aba27ce5f638ccd7c7c4b55a383ac7f3126cd78cc1e7b26a2daf263c
6
+ metadata.gz: 0d1c6e96f27300ab32b675f10b2d00c207792a0534859bbbfaa02f72d855b3af33572422842474cdfddf3a18cd5146eb93060349b03671232b4b4485c262079d
7
+ data.tar.gz: 0db00cb34ddc01b743a1a3f039e80308619134ce722e9f316cc483f36c1db1579d749218be66ab30e31b664996f6eeb9e89a6ffacff6c1763ce8d47dc8193e7e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ### Added
6
+ - `h herdr` and `hh` pane controls for Vim-style focus, two-pane reflow, resize, swap, and zoom
7
+ - `prefix+shift+h/j/k/l` reflows a two-pane tab toward an edge; `prefix+alt+h/j/k/l` resizes the current pane
8
+
3
9
  ## [0.1.384] - 2026-09-23
4
10
 
5
11
  ### Added
data/README.md CHANGED
@@ -152,7 +152,7 @@ See the [task command reference](docs/t.md) for all commands and the [workflow i
152
152
  | `h setup` | Install plugins and subcommands to system paths |
153
153
  | `h edit` | Open the h script in your editor |
154
154
  | `h alert` | macOS desktop notifications via terminal-notifier |
155
- | `h herdr` | Herdr plugin for `t`: fuzzy task switcher, todo capture, todo copy, task shell and nvim popups (`h herdr install`) |
155
+ | `h herdr` | Herdr task popups plus Vim-style pane focus, movement, resize, swap, and zoom controls (`h herdr install`) |
156
156
  | `h task` | Same program as `t`: task records, todos, worktrees (`t NAME tree new`), and Herdr workspaces |
157
157
 
158
158
  ### External Subcommands
data/bin/h-herdr CHANGED
@@ -10,6 +10,16 @@ require 'fileutils'
10
10
 
11
11
  PLUGIN_ID = 'hiiro'
12
12
  ACTIONS = %w[switch todo-add todos shell nvim].freeze
13
+ PANE_DIRECTIONS = {
14
+ 'h' => 'left',
15
+ 'j' => 'down',
16
+ 'k' => 'up',
17
+ 'l' => 'right',
18
+ 'left' => 'left',
19
+ 'down' => 'down',
20
+ 'up' => 'up',
21
+ 'right' => 'right',
22
+ }.freeze
13
23
  INSTALL_DIR = Hiiro::Config.config_dir('herdr-plugin')
14
24
  SOURCE_DIR = File.expand_path('../herdr-plugin', File.dirname(File.realpath(__FILE__)))
15
25
  KEYS_SNIPPET = <<~TOML
@@ -43,6 +53,56 @@ KEYS_SNIPPET = <<~TOML
43
53
  type = "plugin_action"
44
54
  command = "hiiro.nvim"
45
55
  description = "task notes in nvim"
56
+
57
+ # Vim-style pane layout controls. Herdr already uses prefix+h/j/k/l for focus.
58
+ # Uppercase rotates a two-pane tab so the current pane lands on that edge.
59
+ [[keys.command]]
60
+ key = "prefix+shift+h"
61
+ type = "shell"
62
+ command = "h herdr move left"
63
+ description = "move current pane to the left"
64
+
65
+ [[keys.command]]
66
+ key = "prefix+shift+j"
67
+ type = "shell"
68
+ command = "h herdr move down"
69
+ description = "move current pane to the bottom"
70
+
71
+ [[keys.command]]
72
+ key = "prefix+shift+k"
73
+ type = "shell"
74
+ command = "h herdr move up"
75
+ description = "move current pane to the top"
76
+
77
+ [[keys.command]]
78
+ key = "prefix+shift+l"
79
+ type = "shell"
80
+ command = "h herdr move right"
81
+ description = "move current pane to the right"
82
+
83
+ [[keys.command]]
84
+ key = "prefix+alt+h"
85
+ type = "shell"
86
+ command = "h herdr resize left"
87
+ description = "resize current pane left"
88
+
89
+ [[keys.command]]
90
+ key = "prefix+alt+j"
91
+ type = "shell"
92
+ command = "h herdr resize down"
93
+ description = "resize current pane down"
94
+
95
+ [[keys.command]]
96
+ key = "prefix+alt+k"
97
+ type = "shell"
98
+ command = "h herdr resize up"
99
+ description = "resize current pane up"
100
+
101
+ [[keys.command]]
102
+ key = "prefix+alt+l"
103
+ type = "shell"
104
+ command = "h herdr resize right"
105
+ description = "resize current pane right"
46
106
  TOML
47
107
 
48
108
  def herdr_bin
@@ -55,6 +115,45 @@ def source_dir
55
115
  gem_root && File.join(gem_root, 'herdr-plugin')
56
116
  end
57
117
 
118
+ def pane_direction!(value)
119
+ PANE_DIRECTIONS.fetch(value.to_s) do
120
+ raise Hiiro::Error, 'Direction must be h, j, k, l, left, down, up, or right'
121
+ end
122
+ end
123
+
124
+ def pane_ratio!(value)
125
+ return nil if value.nil?
126
+ ratio = Float(value, exception: false)
127
+ raise Hiiro::Error, 'Ratio must be greater than 0 and less than 1' unless ratio && ratio.positive? && ratio < 1
128
+ ratio
129
+ end
130
+
131
+ def move_current_pane(direction, ratio = nil)
132
+ current = herdr_client.current_pane
133
+ raise Hiiro::Error, 'No current Herdr pane' unless current
134
+ panes = herdr_client.panes(workspace: current.workspace_id).select { |pane| pane.tab_id == current.tab_id }
135
+ raise Hiiro::Error, "Move requires exactly two panes in the current tab; found #{panes.length}" unless panes.length == 2
136
+ other = panes.find { |pane| pane.id != current.id }
137
+
138
+ if %w[left up].include?(direction)
139
+ source, target = other, current
140
+ split = direction == 'left' ? 'right' : 'down'
141
+ move_ratio = ratio && 1.0 - ratio
142
+ focus = '--no-focus'
143
+ else
144
+ source, target = current, other
145
+ split = direction
146
+ move_ratio = ratio
147
+ focus = '--focus'
148
+ end
149
+
150
+ detached = system(herdr_bin, 'pane', 'move', source.id, '--new-tab', '--no-focus')
151
+ raise Hiiro::Error, 'Herdr could not detach the pane for reflow' unless detached
152
+ args = ['pane', 'move', source.id, '--tab', target.tab_id, '--target-pane', target.id, '--split', split]
153
+ args += ['--ratio', move_ratio.to_s] if move_ratio
154
+ raise Hiiro::Error, 'Herdr could not reflow the pane' unless system(herdr_bin, *args, focus)
155
+ end
156
+
58
157
  Hiiro.run(*ARGV, external_commands: false) do
59
158
  add_cmd(:install) do
60
159
  no_args = opts.args.empty?
@@ -81,6 +180,33 @@ Hiiro.run(*ARGV, external_commands: false) do
81
180
 
82
181
  add_cmd(:actions) { ACTIONS.each { |name| puts "hiiro.#{name}" } }
83
182
 
183
+ add_cmd(:focus, args: %i[direction]) do
184
+ direction = pane_direction!(opts.args.first)
185
+ raise Hiiro::Error, 'Herdr could not focus the pane' unless system(herdr_bin, 'pane', 'focus', '--current', '--direction', direction)
186
+ end
187
+
188
+ add_cmd(:resize, args: %i[direction amount?]) do
189
+ direction = pane_direction!(opts.args.shift)
190
+ amount = opts.args.shift
191
+ args = ['pane', 'resize', '--current', '--direction', direction]
192
+ args += ['--amount', amount] if amount
193
+ raise Hiiro::Error, 'Herdr could not resize the pane' unless system(herdr_bin, *args)
194
+ end
195
+
196
+ add_cmd(:swap, args: %i[direction]) do
197
+ direction = pane_direction!(opts.args.first)
198
+ raise Hiiro::Error, 'Herdr could not swap the pane' unless system(herdr_bin, 'pane', 'swap', '--current', '--direction', direction)
199
+ end
200
+
201
+ add_cmd(:move, :layout, :arrange, args: %i[direction ratio?]) do
202
+ move_current_pane(pane_direction!(opts.args.shift), pane_ratio!(opts.args.shift))
203
+ end
204
+
205
+ add_cmd(:zoom) do
206
+ raise Hiiro::Error, 'h herdr zoom takes no arguments' unless opts.args.empty?
207
+ raise Hiiro::Error, 'Herdr could not zoom the pane' unless system(herdr_bin, 'pane', 'zoom', '--current', '--toggle')
208
+ end
209
+
84
210
  # Headless: bound to a key, opens the popup with the chosen action.
85
211
  add_cmd(:action, args: %i[name]) do
86
212
  name = opts.args.first
data/bin/hh CHANGED
@@ -44,6 +44,10 @@ Hiiro.run do
44
44
  end
45
45
  end
46
46
 
47
+ %i[focus resize swap move layout arrange zoom].each do |name|
48
+ add_cmd(name) { |*args| system('h', 'herdr', name.to_s, *args) }
49
+ end
50
+
47
51
  add_default do |*args|
48
52
  system 'herdr', *args
49
53
  end
data/docs/h-herdr.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # h herdr
2
2
 
3
- Expose the `t` task CLI inside Herdr as keybound actions. Each action opens a session-modal popup that runs `h herdr popup`, so fuzzy pickers and editors get a real TTY without disturbing the tiled layout.
3
+ Expose task popups and pane controls inside Herdr. Popup actions use the Hiiro plugin; pane focus, reflow, resize, swap, and zoom commands call Herdr's native pane API directly.
4
4
 
5
5
  ## Install
6
6
 
@@ -10,7 +10,7 @@ h herdr keys # prints [[keys.command]] entries to paste into ~/.
10
10
  herdr server reload-config
11
11
  ```
12
12
 
13
- `h herdr uninstall` unlinks the plugin and removes the copied directory. Requires Herdr 0.7.4 or newer, and `sk` or `fzf` on `PATH`.
13
+ `h herdr uninstall` unlinks the plugin and removes the copied directory. Requires Herdr 0.7.4 or newer, and `sk` or `fzf` on `PATH`. Run `h herdr keys` again after upgrading Hiiro, paste the new entries, then reload Herdr's config.
14
14
 
15
15
  ## Actions
16
16
 
@@ -21,21 +21,34 @@ herdr server reload-config
21
21
  | `hiiro.todos` | `prefix+shift+y` | Fuzzy-pick an open todo of the current task and copy its text to the clipboard |
22
22
  | `hiiro.shell` | `prefix+shift+s` | 90% popup running `t sh` in the current task's start directory |
23
23
  | `hiiro.nvim` | `prefix+shift+e` | 90% popup running bare `$EDITOR` (default `nvim`) in the working directory of the pane the key was pressed in |
24
+ | Native Herdr focus | `prefix+h/j/k/l` | Focus the neighboring pane using Herdr's default Vim bindings |
25
+ | Pane reflow | `prefix+shift+h/j/k/l` | Move the current pane to that edge in a two-pane tab; for example `prefix+shift+l` changes a top/bottom split into full-height left/right columns |
26
+ | Pane resize | `prefix+alt+h/j/k/l` | Grow or shrink the current split in that direction |
24
27
 
25
28
  The current task resolves through `Hiiro::CurrentTask`: the popup's Herdr workspace, then the working directory, then the task saved with `t use TASK`. Errors print in the popup for two seconds before it closes.
26
29
 
30
+ Pane reflow intentionally requires exactly two panes in the current tab. This keeps an uppercase movement deterministic: the current pane lands on the requested edge and the other pane occupies the remainder. Use native `h herdr swap DIRECTION` for larger layouts instead of silently rebuilding a multi-pane tree.
31
+
27
32
  ## Subcommands
28
33
 
29
34
  | Command | Behavior |
30
35
  |---|---|
31
36
  | `h herdr install` | Copy the manifest from the gem, link it in Herdr, print next steps |
32
37
  | `h herdr uninstall` | Unlink and remove the copy |
33
- | `h herdr keys` | Print the keybinding snippet |
34
- | `h herdr actions` | List action ids |
35
- | `h herdr action NAME` | Headless: open the popup for NAME (what the manifest binds) |
36
- | `h herdr popup` | Runs inside the popup; reads `HIIRO_HERDR_ACTION` |
38
+ | `h herdr keys` | Print task popup, pane reflow, and pane resize keybindings |
39
+ | `h herdr actions` | List popup action ids |
40
+ | `h herdr action NAME` | Headless: open the popup for NAME |
41
+ | `h herdr popup` | Run the selected action inside the popup |
42
+ | `h herdr focus DIRECTION` | Focus the neighboring pane; accepts `h/j/k/l` or `left/down/up/right` |
43
+ | `h herdr move DIRECTION [RATIO]` | Reflow a two-pane tab with the current pane on DIRECTION and optionally give it RATIO of the available space; aliases: `layout`, `arrange` |
44
+ | `h herdr resize DIRECTION [AMOUNT]` | Resize the current pane split |
45
+ | `h herdr swap DIRECTION` | Swap the current pane with its neighbor |
46
+ | `h herdr zoom` | Toggle current-pane zoom |
47
+
48
+ `hh focus`, `hh move`, `hh layout`, `hh arrange`, `hh resize`, `hh swap`, and `hh zoom` delegate to the same `h herdr` commands.
37
49
 
38
50
  ## Files
39
51
 
40
- - `herdr-plugin/herdr-plugin.toml` in the gem: manifest with five `[[actions]]` and one `[[panes]]` popup entrypoint
41
- - `bin/h-herdr`: actions, popup logic, install and keys helpers
52
+ - `herdr-plugin/herdr-plugin.toml` in the gem: task popup actions and popup entrypoint
53
+ - `bin/h-herdr`: popup logic, pane controls, installation, and keybinding output
54
+ - `bin/hh`: short aliases for the pane controls
data/lib/hiiro/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  class Hiiro
2
- VERSION = "0.1.384"
2
+ VERSION = "0.1.385"
3
3
  SUPPORTED_RUBY_VERSION = ">= 3.2.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiiro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.384
4
+ version: 0.1.385
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota