hiiro 0.1.282 → 0.1.284

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: c11001ebe9c6d60bad456719af866219ae6d2c13fde14019cb1a97f05feb4996
4
+ data.tar.gz: ae2c4644c8dd9a2dfb0c97fad2ca9870f4a35eddf70ebbc04ba3e40df49e6480
5
5
  SHA512:
6
- metadata.gz: c35dadabe8a27c255bf5e9a77de91e4f8b321f51f8713ea480b432b7723c2227cc84ecbe8abf94ce7a277787ed1e92ea7b32f3fe33b374c3398d593242775063
7
- data.tar.gz: 4ae9ad2431d999aff919959d071978c9a420d34eb898f08ca61fe46688d68117c5b8f7aa4245cf02d650cd6fe2b884a43fe3578aa35f071832aae867de1de003
6
+ metadata.gz: b9b748ffd9b8446976815ae76fd0e6540d6c008397b61d1476ce65d32490a60645c00b1c64c2136e79bb5f287c6adb08c7032eca9547525495d727711e77063d
7
+ data.tar.gz: 8e1d1d6fc0361d7ee516ff1e2166b3e4158cd1cf77f6fd273f37f628e1a20f4014b6108efcbd38dc6d9d6d195b9aadcd167f813ae87aa6802096bbfbbde043ca
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [0.1.284] - 2026-03-25
2
+
3
+ ### Added
4
+ - **h-pm bin**: Queue `/project-manager` skill prompts via `h queue add`; subcommands map to all project-manager slash commands (discover, resume, status, add, start, plan, complete, ref, impact, archive, unarchive); interactive default uses fuzzyfind to pick a command
5
+
6
+ ## [0.1.283] - 2026-03-25
7
+
8
+ ### Fixed
9
+ - **h queue cadd/vadd/hadd**: Now `Dir.chdir` to the selected task's base directory (or active pane CWD for session selections) in the Ruby process before spawning the tmux pane, so the editor and `claude` session start in the correct directory
10
+ - **h queue cadd/vadd/hadd**: Added `h queue pane-dir` internal helper that resolves the working directory post-edit (accounting for `app:` and `dir:` frontmatter), used by the generated shell script to `cd` before running `claude`
11
+
1
12
  ## [0.1.282] - 2026-03-25
2
13
 
3
14
  ### Changed
data/bin/h-pm ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'hiiro'
4
+
5
+ def queue_prompt(prompt)
6
+ IO.popen(['h', 'queue', 'add'], 'w') { |io| io.write(prompt) }
7
+ end
8
+
9
+ PM_SUBCOMMANDS = {
10
+ discover: "Auto-discover projects/tasks from PRs, worktrees, olive runs",
11
+ resume: "Show 'where was I?' session briefing for a project",
12
+ status: "Show project status overview",
13
+ add: "Add a new task to a project",
14
+ start: "Load context and begin working on a task",
15
+ plan: "Generate/update proposal doc for a task",
16
+ complete: "Mark a task as complete",
17
+ ref: "Add a reference document (PRD, spec, Figma, etc.)",
18
+ impact: "Analyze cascading impact of task deviation on children",
19
+ archive: "Archive a completed/stale project",
20
+ unarchive: "Restore an archived project",
21
+ }.freeze
22
+
23
+ Hiiro.run(*ARGV) {
24
+ PM_SUBCOMMANDS.each_key do |subcmd|
25
+ add_subcmd(subcmd) { |*args|
26
+ prompt = (["/project-manager", subcmd.to_s] + args).join(' ')
27
+ queue_prompt(prompt)
28
+ }
29
+ end
30
+
31
+ add_subcmd(:help) {
32
+ puts <<~HELP
33
+ h-pm — Queue /project-manager skill prompts via h queue add
34
+
35
+ USAGE:
36
+ h pm Interactive: pick command
37
+ h pm discover [project] Auto-discover untracked work
38
+ h pm resume <project> "Where was I?" session briefing
39
+ h pm status <project> Project status overview
40
+ h pm add <project> <task> Add a new task
41
+ h pm start <project> <task> Load context and begin task
42
+ h pm plan <project> <task> Generate/update proposal doc
43
+ h pm complete <project> <task> Mark task as complete
44
+ h pm ref <project> [url-or-path] Add a reference document
45
+ h pm impact <project> <task> Analyze task deviation impact
46
+ h pm archive <project> Archive a project
47
+ h pm unarchive <project> Restore an archived project
48
+
49
+ Each command builds a /project-manager prompt and queues it via h queue add.
50
+ HELP
51
+ }
52
+
53
+ add_default {
54
+ entries = PM_SUBCOMMANDS.map { |cmd, desc| "#{cmd.to_s.ljust(12)} #{desc}" }
55
+ selected = fuzzyfind(entries)
56
+ next unless selected
57
+ cmd = selected.split.first
58
+ queue_prompt("/project-manager #{cmd}")
59
+ }
60
+ }
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.284"
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.284
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota
@@ -113,6 +113,7 @@ files:
113
113
  - bin/h-pane
114
114
  - bin/h-pgsync
115
115
  - bin/h-plugin
116
+ - bin/h-pm
116
117
  - bin/h-pr
117
118
  - bin/h-pr-monitor
118
119
  - bin/h-project