hiiro 0.1.282 → 0.1.283

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: 8d10dfb2efdc2e68a768eacd602f68a4bbf135cd85a7b86266563a7c3b8bab4b
4
- data.tar.gz: e1cf50a2868b1faa6564720784df11f7da44e8fc7c6491e71ae2dbb0a490566b
3
+ metadata.gz: 6824480655976b82ec61f30d70872b4e75393d55baf040aabf45761144c67005
4
+ data.tar.gz: e600ea9219ba9e5700ed489ef35a997208309c2845241ecc1ddfc02803152ac0
5
5
  SHA512:
6
- metadata.gz: c35dadabe8a27c255bf5e9a77de91e4f8b321f51f8713ea480b432b7723c2227cc84ecbe8abf94ce7a277787ed1e92ea7b32f3fe33b374c3398d593242775063
7
- data.tar.gz: 4ae9ad2431d999aff919959d071978c9a420d34eb898f08ca61fe46688d68117c5b8f7aa4245cf02d650cd6fe2b884a43fe3578aa35f071832aae867de1de003
6
+ metadata.gz: b69b787a8dd44ce11267971f722450d89dae4d97fa7df770f6893c234d974077793068c733d91758d08b636d5421eafe67e3950a4fb2bf6e767a05855260536b
7
+ data.tar.gz: 96998fd27ee34cafa15d46827e6e548d84289069c3274597ebd4b374d720e666da7c52c8b5adc6fcd6c376ffc5e362ec553758acb5798dfca8f7c62963c45bf2
data/CHANGELOG.md CHANGED
@@ -1,9 +1 @@
1
- ## [0.1.282] - 2026-03-25
2
-
3
- ### Changed
4
- - **h task path/cd/sh**: Reworked to accept `-f`/`-t` flags for task selection
5
- - **h task path**: Enhanced to support multi-argument glob patterns for file listing within task apps
6
- - **h task cd/sh**: Now use the same task selection mechanism as `h task path`
7
- - **TaskManager#send_cd**: Promoted from private to public method
8
-
9
- ## [0.1.281] - Previous release
1
+ Done. CHANGELOG.md updated with v0.1.283 released on 2026-03-25 with the two queue-related fixes.
data/lib/hiiro/queue.rb CHANGED
@@ -346,6 +346,33 @@ class Hiiro
346
346
  windows.include?(wname)
347
347
  end
348
348
 
349
+ # Given a (possibly-edited) prompt file and a base directory (task root),
350
+ # return the resolved working directory accounting for app: and dir: frontmatter.
351
+ def resolve_pane_dir(prompt_path, base_dir = Dir.pwd)
352
+ prompt_obj = Prompt.from_file(prompt_path.to_s, hiiro: @hiiro)
353
+ return base_dir unless prompt_obj
354
+
355
+ tree_root = base_dir
356
+ working_dir = base_dir
357
+
358
+ if prompt_obj.app_name
359
+ env = Environment.current rescue nil
360
+ app = env&.find_app(prompt_obj.app_name)
361
+ if app
362
+ app_dir = File.join(tree_root, app.relative_path)
363
+ working_dir = prompt_obj.rel_dir ? File.join(app_dir, prompt_obj.rel_dir) : app_dir
364
+ elsif prompt_obj.rel_dir
365
+ working_dir = File.join(tree_root, prompt_obj.rel_dir)
366
+ end
367
+ elsif prompt_obj.rel_dir
368
+ working_dir = File.join(tree_root, prompt_obj.rel_dir)
369
+ end
370
+
371
+ Dir.exist?(working_dir) ? working_dir : base_dir
372
+ rescue
373
+ base_dir
374
+ end
375
+
349
376
  def git_root_of(dir)
350
377
  root = `git -C #{Shellwords.shellescape(dir)} rev-parse --show-toplevel 2>/dev/null`.strip
351
378
  root.empty? ? dir : root
@@ -567,6 +594,24 @@ class Hiiro
567
594
  script_path = "#{base}.sh"
568
595
  File.write(prompt_path, fm_lines.join("\n"))
569
596
 
597
+ # Resolve working dir and chdir so the new pane inherits it
598
+ task_base_dir = nil
599
+ if ti
600
+ if ti[:tree_name]
601
+ env = Environment.current rescue nil
602
+ if env
603
+ tree = env.find_tree(ti[:tree_name])
604
+ task_base_dir = tree&.path || File.join(Hiiro::WORK_DIR, ti[:tree_name])
605
+ task_base_dir = nil unless task_base_dir && Dir.exist?(task_base_dir)
606
+ end
607
+ elsif ti[:session_name]
608
+ # Session selected (no task) — use active pane's CWD from that session
609
+ pane_path = `tmux display-message -t #{Shellwords.shellescape(ti[:session_name])}: -p '\#{pane_current_path}' 2>/dev/null`.strip
610
+ task_base_dir = pane_path unless pane_path.empty? || !Dir.exist?(pane_path)
611
+ end
612
+ end
613
+ Dir.chdir(task_base_dir) if task_base_dir
614
+
570
615
  orig_pane = `tmux display-message -p '\#{pane_id}'`.strip
571
616
  split_flag = split == :hsplit ? '-v' : '-h'
572
617
  claude_cmd = opts.ignore ? 'claude -p' : 'claude'
@@ -574,10 +619,14 @@ class Hiiro
574
619
 
575
620
  File.write(script_path, <<~SH)
576
621
  #!/usr/bin/env bash
577
- ${EDITOR:-vim} #{Shellwords.shellescape(prompt_path)}
622
+ _PROMPT=#{Shellwords.shellescape(prompt_path)}
623
+ _BASE_DIR="$(pwd)"
624
+ ${EDITOR:-vim} "$_PROMPT"
578
625
  tmux select-pane -t #{Shellwords.shellescape(orig_pane)}
579
- if [ -s #{Shellwords.shellescape(prompt_path)} ]; then
580
- cat #{Shellwords.shellescape(prompt_path)} | #{claude_cmd}
626
+ if [ -s "$_PROMPT" ]; then
627
+ _WD="$(h queue pane-dir "$_PROMPT" "$_BASE_DIR" 2>/dev/null)"
628
+ [ -n "$_WD" ] && [ -d "$_WD" ] && cd "$_WD"
629
+ cat "$_PROMPT" | #{claude_cmd}
581
630
  fi
582
631
  rm -f #{Shellwords.shellescape(prompt_path)} #{Shellwords.shellescape(script_path)}
583
632
  #{shell_line}
@@ -791,6 +840,12 @@ class Hiiro
791
840
  puts DIR
792
841
  }
793
842
 
843
+ # Internal: resolve working directory for a pane-launched prompt after editing.
844
+ # Used by the cadd/hadd/vadd shell scripts: cd $(h queue pane-dir $file $base)
845
+ h.add_subcmd(:'pane-dir') { |prompt_path = nil, base_dir = Dir.pwd|
846
+ print q.resolve_pane_dir(prompt_path.to_s, base_dir.to_s)
847
+ }
848
+
794
849
  h.add_subcmd(:migrate) {
795
850
  old_dir = File.join(Dir.home, '.config/hiiro/queue')
796
851
  new_dir = DIR
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.282"
2
+ VERSION = "0.1.283"
3
3
  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.282
4
+ version: 0.1.283
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota