hiiro 0.1.374 → 0.1.376

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: 2eeea73b7e9f5a66d4156b20253a3b5815802c65c1ca9740694647fd9e2347e4
4
- data.tar.gz: 3f79d0998110b47a4bc98f27764042a0ac48f263a6a2abb1ed8d59a6ddf512c3
3
+ metadata.gz: a8a343767837132ea50864926898caf5fcbc01788bbfadd351f426fe6e7bc770
4
+ data.tar.gz: e8274d74d87414a087f45f3bf65584ecec9ffd999d48ca5328591e729babdf9e
5
5
  SHA512:
6
- metadata.gz: b023e9228aa0f2bc9053df47ce1fb37ad81b545c4ddbbb81735e0a32da501641252b61ed86ecd9319188b2838c90c9183283f3233087c825799e48905cb5d0bb
7
- data.tar.gz: 5c952b79fb9bcf1697e7a1b88d86f097e6ba91220db03dc682ced02475ec10fa638da33578019e55fa2cfc441665a3808cee2ba7b45107056a8676cedf23ab2d
6
+ metadata.gz: 46b9f915a21b4c84a14971b5b30aa1a6f48f1507b049eb4ff59546e627c9eccb84cc0ac8863591dc50ab4f4ae4afff3af45c599c430751bcc3b1b7bb3e81fefc
7
+ data.tar.gz: 45c777ea183fbc5eb26de72be4b7a4e303423c76f0ca99431b492d6615e82d296932cddb17c46f7f2ea6dabdd936e2762290d9a81375dc5d82413f35d770fabe
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.1.376] - 2026-09-14
6
+
7
+ ### Changed
8
+ - Herdr `hiiro.nvim` action opens bare `nvim` in the calling pane's working directory instead of the task notes home
9
+
10
+ ## [0.1.375] - 2026-09-14
11
+
12
+ ### Changed
13
+ - `t switch`, `t tab open`, and `t pane open` no longer default to the current task; with no destination they open the picker (tasks, workspaces, panes, or tabs) and fail non-interactively. `.` still means the current task
14
+
5
15
  ## [0.1.374] - 2026-09-14
6
16
 
7
17
  ### Changed
data/bin/h-herdr CHANGED
@@ -86,8 +86,20 @@ Hiiro.run(*ARGV, external_commands: false) do
86
86
  name = opts.args.first
87
87
  raise Hiiro::Error, "Unknown action #{name}; one of #{ACTIONS.join(', ')}" unless ACTIONS.include?(name)
88
88
  size = %w[shell nvim].include?(name) ? %w[--width 90% --height 90%] : []
89
+ extra = []
90
+ if name == 'nvim' && (cwd = calling_pane_cwd)
91
+ extra = ['--cwd', cwd, '--env', "HIIRO_HERDR_CWD=#{cwd}"]
92
+ end
89
93
  system(herdr_bin, 'plugin', 'pane', 'open', '--plugin', PLUGIN_ID, '--entrypoint', 'popup',
90
- '--env', "HIIRO_HERDR_ACTION=#{name}", *size, '--focus')
94
+ '--env', "HIIRO_HERDR_ACTION=#{name}", *size, *extra, '--focus')
95
+ end
96
+
97
+ # Working directory of the pane the key was pressed in (HERDR_PANE_ID, else the focused pane).
98
+ def calling_pane_cwd
99
+ pane = ENV['HERDR_PANE_ID'] ? herdr_client.get_pane(ENV['HERDR_PANE_ID']) : herdr_client.panes(all: true).find(&:focused?)
100
+ pane && (pane.foreground_cwd || pane.cwd)
101
+ rescue StandardError
102
+ nil
91
103
  end
92
104
 
93
105
  # Runs inside the popup pane (real TTY, HERDR_WORKSPACE_ID set by Herdr).
@@ -144,10 +156,9 @@ Hiiro.run(*ARGV, external_commands: false) do
144
156
  when 'shell'
145
157
  exec('t', 'sh')
146
158
  when 'nvim'
147
- task = Hiiro::CurrentTask.new(herdr: -> { herdr_client }, pin: true).resolve!
148
- FileUtils.mkdir_p(task.home)
149
- Dir.chdir(task.home)
150
- exec(ENV['EDITOR'] || 'nvim', '.')
159
+ cwd = ENV['HIIRO_HERDR_CWD']
160
+ Dir.chdir(cwd) if cwd && Dir.exist?(cwd)
161
+ exec(ENV['EDITOR'] || 'nvim')
151
162
  end
152
163
  rescue Hiiro::Error => e
153
164
  pause("ERROR: #{e.message}")
data/docs/h-herdr.md CHANGED
@@ -20,7 +20,7 @@ herdr server reload-config
20
20
  | `hiiro.todo-add` | `prefix+shift+a` | Fuzzy-pick a task (current task first), type the todo text, then `t NAME todo add TEXT` |
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
- | `hiiro.nvim` | `prefix+shift+e` | 90% popup running `$EDITOR` (default `nvim`) in the current task's notes home |
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
24
 
25
25
  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
26
 
data/docs/t.md CHANGED
@@ -112,7 +112,7 @@ t pane run [TASK] ID|LABEL [--] COMMAND...
112
112
  t pane split [TASK] ID|LABEL [--direction right|down] [--directory PATH] [--command COMMAND]
113
113
  ```
114
114
 
115
- These require a running Herdr server. The workspace label is the task session or name with `.` replaced by `_`. `switch` also accepts the name of a live Herdr workspace that belongs to no task, exactly or by unique prefix, and focuses it; a task with the same name wins. An exact pane ID such as `w6:p2` focuses that pane, and the picker lists every live pane with its directory and foreground command. When the name is ambiguous, or no task or context is given, a terminal gets a fuzzy finder over tasks and loose workspaces, with duplicate workspace names numbered in the label only. `switch` focuses the existing task workspace or creates it in the start directory (`--directory`, else primary directory, worktree, or home), and saves the task as the fallback when it was named explicitly. `--show` only prints the workspace, tabs, and panes. Tab and pane references match a live ID or label, then a unique prefix; with no reference and several candidates a fuzzy finder opens.
115
+ These require a running Herdr server. The workspace label is the task session or name with `.` replaced by `_`. `switch` also accepts the name of a live Herdr workspace that belongs to no task, exactly or by unique prefix, and focuses it; a task with the same name wins. An exact pane ID such as `w6:p2` focuses that pane, and the picker lists every live pane with its directory and foreground command. When the name is ambiguous, or no task or context is given, a terminal gets a fuzzy finder over tasks and loose workspaces, with duplicate workspace names numbered in the label only. Commands that jump somewhere never assume the current task: `t switch`, `t tab open`, and `t pane open` with no task open the picker instead (or fail when stdin is not a terminal); `.` still names the current task explicitly. `t pane open PANE_ID` and `t tab open TAB_ID` jump to any live pane or tab. `switch` focuses the existing task workspace or creates it in the start directory (`--directory`, else primary directory, worktree, or home), and saves the task as the fallback when it was named explicitly. `--show` only prints the workspace, tabs, and panes. Tab and pane references match a live ID or label, then a unique prefix; with no reference and several candidates a fuzzy finder opens.
116
116
 
117
117
  ## Native AI sessions
118
118
 
@@ -34,7 +34,7 @@ command = ["h", "herdr", "action", "shell"]
34
34
 
35
35
  [[actions]]
36
36
  id = "nvim"
37
- title = "nvim in the current task notes"
37
+ title = "nvim in the current pane directory"
38
38
  contexts = ["workspace"]
39
39
  command = ["h", "herdr", "action", "nvim"]
40
40
 
data/lib/hiiro/herdr.rb CHANGED
@@ -102,6 +102,8 @@ class Hiiro
102
102
  @agent_status = data['agent_status']
103
103
  end
104
104
 
105
+ def name = label
106
+
105
107
  alias name label
106
108
  alias index number
107
109
  alias panes pane_count
@@ -565,15 +565,50 @@ class Hiiro
565
565
  target = pick_switch_target(task_matches, ws_matches, panes: [])
566
566
  return [target, target.is_a?(Hiiro::TaskRecord)]
567
567
  end
568
- args.shift if first == '.'
568
+ if first == '.'
569
+ args.shift
570
+ no_args!(args)
571
+ return [Hiiro::CurrentTask.new(herdr: -> { herdr_client }, pin: true).resolve!, false]
572
+ end
569
573
  no_args!(args)
570
- begin
571
- [Hiiro::CurrentTask.new(herdr: -> { herdr_client }, pin: true).resolve!, false]
572
- rescue Hiiro::Error => e
573
- raise unless $stdin.tty? && e.message.start_with?('No current task')
574
- target = pick_switch_target(Hiiro::TaskRecord.all_as_list, loose_workspaces)
575
- [target, target.is_a?(Hiiro::TaskRecord)]
574
+ # Jumping somewhere never assumes the current task: pick a destination.
575
+ raise Error, 'Name a task, workspace, or pane to switch to, or use . for the current task' unless $stdin.tty?
576
+ target = pick_switch_target(Hiiro::TaskRecord.all_as_list, loose_workspaces)
577
+ [target, target.is_a?(Hiiro::TaskRecord)]
578
+ end
579
+
580
+ def require_picker!(what)
581
+ raise Error, "Name a task or #{what} to jump to" unless $stdin.tty?
582
+ end
583
+
584
+ def tab_line(tab)
585
+ workspace = live_workspaces.find { |candidate| candidate.id == tab.workspace_id }
586
+ [tab.id, workspace&.name, tab.label].compact.join(' ')
587
+ end
588
+
589
+ # `pane open` / `tab open` with no task: pick from every live pane or tab.
590
+ def jump_to_pane(reference)
591
+ panes = live_panes.values.flatten
592
+ pane = if reference
593
+ live_item('pane', panes, reference)
594
+ else
595
+ require_picker!('pane')
596
+ fuzzyfind_from_map(panes.to_h { |candidate| [pane_line(candidate), candidate] }) || raise(Error, 'Nothing selected')
576
597
  end
598
+ focus_pane_target(pane)
599
+ end
600
+
601
+ def jump_to_tab(reference)
602
+ tabs = client.tabs(all: true).to_a
603
+ tab = if reference
604
+ live_item('tab', tabs, reference)
605
+ else
606
+ require_picker!('tab')
607
+ fuzzyfind_from_map(tabs.to_h { |candidate| [tab_line(candidate), candidate] }) || raise(Error, 'Nothing selected')
608
+ end
609
+ check_result(client.focus_workspace(tab.workspace_id))
610
+ check_result(client.focus_tab(tab.id))
611
+ puts tab_line(tab)
577
612
  end
578
613
 
579
614
  # --- Worktrees (shared with h task via Hiiro::TaskManager) ---
@@ -829,11 +864,15 @@ class Hiiro
829
864
  new_tab(task, single(rest, optional: true))
830
865
  end
831
866
  add_cmd(:open, args: ['task?', 'reference?'], opts: TASK_OPTIONS) do
832
- task, rest = take_task(opts.args)
833
- workspace = workspace_for(task)
834
- tab = live_item('tab', client.tabs(workspace: workspace), single(rest, optional: true))
835
- check_result(client.focus_workspace(workspace.id))
836
- check_result(client.focus_tab(tab.id))
867
+ if opts.task || opts.find || opts.args.first == '.' || (opts.args.first && lookup_task(opts.args.first))
868
+ task, rest = take_task(opts.args)
869
+ workspace = workspace_for(task)
870
+ tab = live_item('tab', client.tabs(workspace: workspace), single(rest, optional: true))
871
+ check_result(client.focus_workspace(workspace.id))
872
+ check_result(client.focus_tab(tab.id))
873
+ else
874
+ jump_to_tab(single(opts.args, optional: true))
875
+ end
837
876
  end
838
877
  end
839
878
  end
@@ -848,10 +887,16 @@ class Hiiro
848
887
  add_cmd(:list, :ls, args: ['task?'], opts: TASK_OPTIONS) do
849
888
  client.panes(workspace: workspace_for(take_task_only(opts.args))).each { |pane| puts pane }
850
889
  end
851
- %w[open read].each do |action|
852
- add_cmd(action, args: ['task?', 'pane?'], opts: TASK_OPTIONS) do
890
+ add_cmd(:read, args: ['task?', 'pane?'], opts: TASK_OPTIONS) do
891
+ task, rest = take_task(opts.args)
892
+ pane_action(task, 'read', rest)
893
+ end
894
+ add_cmd(:open, args: ['task?', 'pane?'], opts: TASK_OPTIONS) do
895
+ if opts.task || opts.find || opts.args.first == '.' || (opts.args.first && lookup_task(opts.args.first))
853
896
  task, rest = take_task(opts.args)
854
- pane_action(task, action, rest)
897
+ pane_action(task, 'open', rest)
898
+ else
899
+ jump_to_pane(single(opts.args, optional: true))
855
900
  end
856
901
  end
857
902
  add_cmd(:run, args: ['task?', 'pane', 'command...'], passthrough: true) do
data/lib/hiiro/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  class Hiiro
2
- VERSION = "0.1.374"
2
+ VERSION = "0.1.376"
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.374
4
+ version: 0.1.376
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota