hiiro 0.1.101.pre.1 → 0.1.101

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: 4527fe0aa477f01194723db640e4b86a0ec1776b95e3abdc8e5434d7646d8c57
4
- data.tar.gz: 5241c8faa013b8e3df039dbbe863bed8ffe1fa4e08241b75f200fab920c77c8a
3
+ metadata.gz: 2a0868dda489ffdfa214f45a591fa2f8e5375afce1e1b5224313eb78d2b3330c
4
+ data.tar.gz: ea0ee2867a93460a4417a699f4a6486afd2315ab3d40a3c6ff1f7a7346682482
5
5
  SHA512:
6
- metadata.gz: 6c562bb508e429ce9584a1d2f8e1a1ceca7be83a4535596568460621bc18fa809465f3b6db73e6d9892db44186587d964789d0ec486227f3739bc9fb68285059
7
- data.tar.gz: a87e98e4b21bdcd588c7f59776c8acee9ddac3e1ef074669e38ee566fc04bdd53cb6c39d3ddf8ee33c75cff26fa73fa924f25d2a0d02fe10528f67722f9f2cfb
6
+ metadata.gz: e98de821ad4e4c654fdbf6dad34aa27fcce13431e671af6620aa6252a12b2a6aba6a18f1ada056888fc36ece651a743b461a1a3245908f637a3c9383f0f9adb6
7
+ data.tar.gz: 4d95da4f77b667c544451740bb809b87178cf321b4b30bddc6d9478480902fd164d15d43454d94cfd421e298d421719b0e6c27456b419dd63447a3bbab680604
data/CLAUDE.md CHANGED
@@ -26,7 +26,20 @@ ruby -c bin/h
26
26
  ruby -c plugins/*.rb
27
27
  ```
28
28
 
29
- There is no build step or test suite. This is a pure Ruby CLI tool.
29
+ ## Testing
30
+
31
+ Run the test suite with:
32
+
33
+ ```bash
34
+ bundle exec rake test
35
+ ```
36
+
37
+ Tests are organized under `test/`:
38
+ - `test/hiiro/` - Core library tests (Matcher, Options, Shell, Fuzzyfind, Todo, etc.)
39
+ - `test/plugins/` - Plugin tests (Pins, Tasks, Notify, Project)
40
+ - `test/bin/` - Bin file tests using `Hiiro::TestHarness`
41
+
42
+ The `Hiiro::TestHarness` class (in `test/test_helper.rb`) enables testing bin files by capturing the block passed to `Hiiro.run` and evaluating it in a test context with stubbed `system` calls.
30
43
 
31
44
  ## Architecture
32
45
 
@@ -157,9 +170,9 @@ Main entry point with class methods:
157
170
  Instance methods available in subcommand blocks:
158
171
  - `git` - Returns `Hiiro::Git` instance for git operations
159
172
  - `fuzzyfind(lines)` - Interactive selection via skim
173
+ - `fuzzyfind_from_map(hash)` - Interactive selection returning mapped value
160
174
  - `pins` - Key-value storage per command
161
175
  - `todo_manager` - Todo item management
162
- - `history` - Command history tracking
163
176
  - `attach_method(name, &block)` - Add methods to hiiro instance dynamically
164
177
  - `make_child(subcmd, *args)` - Create nested Hiiro for sub-subcommands
165
178
 
@@ -232,30 +245,52 @@ tm.active # Items not done/skipped
232
245
  tm.filter_by_task("feature") # Items for specific task
233
246
  ```
234
247
 
235
- ### Hiiro::History (lib/hiiro/history.rb)
248
+ ### Hiiro::Shell (lib/hiiro/shell.rb)
249
+
250
+ Utility for piping content to external commands:
251
+
252
+ ```ruby
253
+ Hiiro::Shell.pipe("content", "pbcopy") # Pipe string to command
254
+ Hiiro::Shell.pipe_lines(["a", "b"], "command") # Join array with newlines and pipe
255
+ ```
256
+
257
+ ### Hiiro::Options (lib/hiiro/options.rb)
258
+
259
+ Argument parsing with flag and option support:
260
+
261
+ ```ruby
262
+ opts = Hiiro::Options.parse(args) do
263
+ option(:output, short: :o, desc: "Output file")
264
+ option(:verbose, short: :v, type: :flag, desc: "Verbose output")
265
+ end
266
+ opts.output # Value of --output or -o
267
+ opts.verbose # true if --verbose or -v was passed
268
+ opts.args # Remaining non-option arguments
269
+ ```
270
+
271
+ ### Hiiro::Notification (lib/hiiro/notification.rb)
236
272
 
237
- Command history tracking with tmux/git/task context:
273
+ macOS notification wrapper using terminal-notifier:
238
274
 
239
275
  ```ruby
240
- History.track(cmd: full_command, hiiro: self) # Auto-called after commands
241
- History.by_task("feature") # Filter by task
242
- History.by_branch("main") # Filter by git branch
243
- History.by_session("work") # Filter by tmux session
276
+ Hiiro::Notification.show(hiiro) # Show notification based on hiiro.args
277
+ # Supports: -m message, -t title, -l link, -c command, -s sound
244
278
  ```
245
279
 
246
280
  ## Key Files
247
281
 
248
- - `bin/h` - Core framework (~420 lines)
249
- - `bin/h-*` - External subcommands (tmux wrappers, video operations)
250
- - `plugins/*.rb` - Reusable plugin modules (Pins, Project, Task, Tmux, Notify)
282
+ - `bin/h` - Entry point that loads lib/hiiro.rb
283
+ - `bin/h-*` - External subcommands (tmux wrappers, git helpers, todo, links, etc.)
284
+ - `plugins/*.rb` - Reusable plugin modules (Pins, Project, Tasks, Notify)
251
285
  - `lib/hiiro.rb` - Main Hiiro class and Runners
252
- - `lib/hiiro/*.rb` - Supporting classes (Git, Matcher, Fuzzyfind, Todo, History)
286
+ - `lib/hiiro/*.rb` - Supporting classes (Git, Matcher, Fuzzyfind, Todo, Shell, Options, Notification, Tmux)
253
287
 
254
288
  ## External Dependencies
255
289
 
256
290
  - Ruby with `pry` gem
257
291
  - `tmux` for session/window/pane management
258
- - `ffmpeg`/`ffprobe` for video operations (h-video)
292
+ - `sk` (skim) or `fzf` for fuzzy finding
293
+ - `gh` CLI for GitHub operations (h-pr)
259
294
  - `terminal-notifier` for macOS notifications (notify plugin)
260
295
 
261
296
  ## Configuration Locations
data/README.md CHANGED
@@ -24,7 +24,7 @@ h setup
24
24
 
25
25
  This installs:
26
26
  - Plugins to `~/.config/hiiro/plugins/`
27
- - Subcommands (`h-video`, `h-buffer`, etc.) to `~/bin/`
27
+ - Subcommands (`h-buffer`, `h-todo`, etc.) to `~/bin/`
28
28
 
29
29
  Ensure `~/bin` is in your `$PATH`.
30
30
 
@@ -37,6 +37,9 @@ brew install terminal-notifier
37
37
 
38
38
  # For fuzzy-finder
39
39
  brew install sk # (or fzf)
40
+
41
+ # For GitHub PR management
42
+ brew install gh
40
43
  ```
41
44
 
42
45
  ## Quick Start
@@ -60,41 +63,28 @@ h ping
60
63
  | `h ping` | Simple test command (returns "pong") |
61
64
  | `h setup` | Install plugins and subcommands to system paths |
62
65
  | `h edit` | Open the h script in your editor |
63
- | `h path` | Print the current directory |
64
- | `h ppath` | Print project path (git root + relative dir) |
65
- | `h rpath` | Print relative path from git root |
66
- | `h pin` | Per-command key-value storage (via Pins plugin) |
67
- | `h project` | Project navigation with tmux integration (via Project plugin) |
68
- | `h task` | Task management across git worktrees (via Task plugin) |
69
- | `h notify` | macOS desktop notifications via terminal-notifier (via Notify plugin) |
66
+ | `h alert` | macOS desktop notifications via terminal-notifier |
67
+ | `h task` | Task management across git worktrees (via Tasks plugin) |
68
+ | `h subtask` | Subtask management within tasks (via Tasks plugin) |
70
69
 
71
70
  ### External Subcommands
72
71
 
73
72
  | Command | Description |
74
73
  |---------|-------------|
75
- | `h branch` | Record and manage git branch history for tasks |
74
+ | `h app` | Manage app directories within tasks/projects |
75
+ | `h branch` | Git branch management with fuzzy selection and copy |
76
76
  | `h buffer` | Tmux paste buffer management |
77
- | `h dot` | Compare directories and generate symlink/diff commands |
78
- | `h dotfiles` | Manage dotfiles in ~/proj/home |
79
- | `h home` | Manage home directory files with edit and search |
80
- | `h html` | Generate an HTML index of MP4 videos in current directory |
77
+ | `h claude` | Claude CLI wrapper with tmux split support |
78
+ | `h commit` | Select commits using fuzzy finder |
79
+ | `h config` | Open config files (vim, git, tmux, zsh, starship, claude) |
81
80
  | `h link` | Manage saved links with URL, description, and shorthand |
82
- | `h mic` | Control macOS microphone input volume |
83
- | `h note` | Create, edit, list, and display notes |
84
81
  | `h pane` | Tmux pane management |
85
82
  | `h plugin` | Manage hiiro plugins (list, edit, search) |
86
- | `h pr` | Record PR information linked to tasks |
87
- | `h pr-monitor` | Monitor pull requests |
88
- | `h pr-watch` | Watch pull requests for updates |
89
- | `h project` | Open projects with tmux session management |
90
- | `h runtask` | Run templated task scripts |
91
- | `h serve` | Start a miniserve HTTP server on port 1111 |
83
+ | `h pr` | GitHub PR management via gh CLI |
84
+ | `h project` | Project navigation with tmux session management |
92
85
  | `h session` | Tmux session management |
93
86
  | `h sha` | Extract short SHA from git log |
94
- | `h subtask` | Shorthand for task subtask management |
95
- | `h task` | Comprehensive task manager for git worktrees |
96
- | `h video` | Video inspection and operations via ffprobe/ffmpeg |
97
- | `h vim` | Manage nvim configuration with edit and search |
87
+ | `h todo` | Todo list management with tags and task association |
98
88
  | `h window` | Tmux window management |
99
89
  | `h wtree` | Git worktree management |
100
90
 
@@ -103,9 +93,9 @@ h ping
103
93
  Any subcommand can be abbreviated as long as the prefix uniquely matches:
104
94
 
105
95
  ```sh
106
- h ex hel # matches h example hello
107
- h te # matches h test (if unique)
108
- h pp # matches h ppath
96
+ h buf ls # matches h buffer ls
97
+ h ses ls # matches h session ls
98
+ h win # matches h window
109
99
  ```
110
100
 
111
101
  If multiple commands match, the first match wins and a warning is logged (when logging is enabled).
@@ -118,8 +108,7 @@ Plugins are Ruby modules loaded from `~/.config/hiiro/plugins/`:
118
108
  |--------|-------------|
119
109
  | Pins | Per-command YAML key-value storage |
120
110
  | Project | Project directory navigation with tmux session management |
121
- | Task | Task lifecycle management across git worktrees with subtask support |
122
- | Tmux | Tmux session helpers used by Project and Task |
111
+ | Tasks | Task lifecycle management across git worktrees with subtask support |
123
112
  | Notify | macOS desktop notifications via terminal-notifier |
124
113
 
125
114
  ## Adding Subcommands
@@ -145,12 +134,12 @@ For nested subcommands, use hiiro in your script:
145
134
  #!/usr/bin/env ruby
146
135
  # ~/bin/h-example
147
136
 
148
- load File.join(Dir.home, 'bin/h')
137
+ require 'hiiro'
149
138
 
150
- Hiiro.init(*ARGV) do |hiiro|
151
- hiiro.add_subcommand(:hello) { puts "Hi!" }
152
- hiiro.add_subcommand(:bye) { puts "Goodbye!" }
153
- end.run
139
+ Hiiro.run(*ARGV) do
140
+ add_subcmd(:hello) { puts "Hi!" }
141
+ add_subcmd(:bye) { puts "Goodbye!" }
142
+ end
154
143
  ```
155
144
 
156
145
  ```sh
@@ -160,23 +149,21 @@ h example bye # => Goodbye!
160
149
 
161
150
  ### Method 2: Inline Subcommands
162
151
 
163
- Modify `bin/h` directly to add subcommands to the base `h` command:
152
+ Modify `exe/h` directly to add subcommands to the base `h` command:
164
153
 
165
154
  ```ruby
166
- hiiro = Hiiro.init(*ARGV, plugins: [Pins, Project, Task], cwd: Dir.pwd)
167
-
168
- hiiro.add_subcommand(:hello) do |*args|
169
- puts "Hello, #{args.first || 'World'}!"
155
+ Hiiro.run(*ARGV, plugins: [Tasks], cwd: Dir.pwd) do
156
+ add_subcmd(:hello) do |*args|
157
+ puts "Hello, #{args.first || 'World'}!"
158
+ end
170
159
  end
171
-
172
- hiiro.run
173
160
  ```
174
161
 
175
- Global values (like `cwd`) are passed to all subcommand handlers via keyword arguments:
162
+ Global values (like `cwd`) are accessible via `get_value`:
176
163
 
177
164
  ```ruby
178
- hiiro.add_subcommand(:pwd) do |*args, **values|
179
- puts values[:cwd] # Access the cwd passed during init
165
+ add_subcmd(:pwd) do |*args|
166
+ puts get_value(:cwd)
180
167
  end
181
168
  ```
182
169
 
@@ -212,7 +199,7 @@ end
212
199
  Load plugins in your command:
213
200
 
214
201
  ```ruby
215
- Hiiro.init(*ARGV, plugins: [MyPlugin]) do |hiiro|
202
+ Hiiro.run(*ARGV, plugins: [MyPlugin]) do
216
203
  # ...
217
204
  end
218
205
  ```
@@ -228,6 +215,15 @@ All configuration lives in `~/.config/hiiro/`:
228
215
  tasks/ # Task metadata
229
216
  projects.yml # Project aliases
230
217
  apps.yml # App directory mappings
218
+ todo.yml # Todo items
219
+ ```
220
+
221
+ ## Testing
222
+
223
+ Run the test suite:
224
+
225
+ ```sh
226
+ bundle exec rake test
231
227
  ```
232
228
 
233
229
  ## License
data/bin/h-todo CHANGED
@@ -90,7 +90,7 @@ Hiiro.run(*ARGV, todo_file: tm.todo_file) do
90
90
  add_subcmd(:rm) do |*rm_args|
91
91
  id_or_index = rm_args.shift
92
92
  if id_or_index.nil?
93
- puts "Usage: h todo rm <id|index>"
93
+ puts "Usage: h todo rm <id>"
94
94
  exit 1
95
95
  end
96
96
 
@@ -110,7 +110,7 @@ Hiiro.run(*ARGV, todo_file: tm.todo_file) do
110
110
  add_subcmd(:change) do |*change_args|
111
111
  id_or_index = change_args.shift
112
112
  if id_or_index.nil?
113
- puts "Usage: h todo change <id|index> [--text TEXT] [--tags TAGS] [--status STATUS]"
113
+ puts "Usage: h todo change <id> [--text TEXT] [--tags TAGS] [--status STATUS]"
114
114
  exit 1
115
115
  end
116
116
 
@@ -146,7 +146,7 @@ Hiiro.run(*ARGV, todo_file: tm.todo_file) do
146
146
  add_subcmd(:start) do |*start_args|
147
147
  id_or_index = start_args.shift
148
148
  if id_or_index.nil?
149
- puts "Usage: h todo start <id|index>"
149
+ puts "Usage: h todo start <id>"
150
150
  exit 1
151
151
  end
152
152
 
@@ -162,7 +162,7 @@ Hiiro.run(*ARGV, todo_file: tm.todo_file) do
162
162
  add_subcmd(:done) do |*done_args|
163
163
  id_or_index = done_args.shift
164
164
  if id_or_index.nil?
165
- puts "Usage: h todo done <id|index>"
165
+ puts "Usage: h todo done <id>"
166
166
  exit 1
167
167
  end
168
168
 
@@ -178,7 +178,7 @@ Hiiro.run(*ARGV, todo_file: tm.todo_file) do
178
178
  add_subcmd(:skip) do |*skip_args|
179
179
  id_or_index = skip_args.shift
180
180
  if id_or_index.nil?
181
- puts "Usage: h todo skip <id|index>"
181
+ puts "Usage: h todo skip <id>"
182
182
  exit 1
183
183
  end
184
184
 
@@ -194,7 +194,7 @@ Hiiro.run(*ARGV, todo_file: tm.todo_file) do
194
194
  add_subcmd(:reset) do |*reset_args|
195
195
  id_or_index = reset_args.shift
196
196
  if id_or_index.nil?
197
- puts "Usage: h todo reset <id|index>"
197
+ puts "Usage: h todo reset <id>"
198
198
  exit 1
199
199
  end
200
200
 
@@ -245,23 +245,27 @@ Hiiro.run(*ARGV, todo_file: tm.todo_file) do
245
245
  add [text] [-t tags] Add todo item(s)
246
246
  With no args, opens editor for YAML input
247
247
 
248
- rm, remove <id|index> Remove a todo item
248
+ rm, remove <id> Remove a todo item
249
249
 
250
- change <id|index> Modify a todo item
250
+ change <id> Modify a todo item
251
251
  --text TEXT New text
252
252
  --tags TAGS New tags
253
253
  --status STATUS New status
254
254
 
255
- start <id|index> Mark item as started
256
- done <id|index> Mark item as done
257
- skip <id|index> Mark item as skipped
258
- reset <id|index> Reset item to not_started
255
+ start <id> Mark item as started
256
+ done <id> Mark item as done
257
+ skip <id> Mark item as skipped
258
+ reset <id> Reset item to not_started
259
259
 
260
260
  search <query> Search items by text, tags, or task
261
261
 
262
262
  path Print path to todo.yml
263
263
  editall Open todo.yml in editor
264
264
 
265
+ Item IDs:
266
+ Items are identified by a permanent numeric ID (1, 2, 3, ...).
267
+ IDs are never reused, even after items are deleted.
268
+
265
269
  Status icons:
266
270
  [ ] not_started
267
271
  [>] started
data/docs/README.md CHANGED
@@ -8,29 +8,20 @@ This directory contains detailed documentation for all Hiiro subcommands.
8
8
 
9
9
  | Command | Description |
10
10
  |---------|-------------|
11
+ | h-app | Manage app directories within tasks/projects |
12
+ | h-branch | Git branch management with fuzzy selection and copy |
11
13
  | [h-buffer](h-buffer.md) | Tmux paste buffer management |
12
- | h-branch | Record and manage git branch history for tasks |
13
- | h-dot | Compare directories and generate symlink/diff commands |
14
- | h-dotfiles | Manage dotfiles in ~/proj/home |
15
- | h-home | Manage home directory files with edit and search |
16
- | h-html | Generate an HTML index of MP4 videos in current directory |
14
+ | h-claude | Claude CLI wrapper with tmux split support |
15
+ | h-commit | Select commits using fuzzy finder |
16
+ | h-config | Open config files (vim, git, tmux, zsh, starship, claude) |
17
17
  | h-link | Manage saved links with URL, description, and shorthand |
18
- | h-mic | Control macOS microphone input volume |
19
- | h-note | Create, edit, list, and display notes |
20
18
  | [h-pane](h-pane.md) | Tmux pane management |
21
19
  | [h-plugin](h-plugin.md) | Manage hiiro plugins (list, edit, search) |
22
- | h-pr | Record PR information linked to tasks |
23
- | h-pr-monitor | Monitor pull requests |
24
- | h-pr-watch | Watch pull requests for updates |
25
- | h-project | Open projects with tmux session management |
26
- | h-runtask | Run templated task scripts |
27
- | h-serve | Start a miniserve HTTP server on port 1111 |
20
+ | h-pr | GitHub PR management via gh CLI |
21
+ | h-project | Project navigation with tmux session management |
28
22
  | [h-session](h-session.md) | Tmux session management |
29
23
  | h-sha | Extract short SHA from git log |
30
- | h-subtask | Shorthand for task subtask management |
31
- | h-task | Comprehensive task manager for git worktrees |
32
- | [h-video](h-video.md) | Video inspection and operations via ffprobe/ffmpeg |
33
- | h-vim | Manage nvim configuration with edit and search |
24
+ | h-todo | Todo list management with tags and task association |
34
25
  | [h-window](h-window.md) | Tmux window management |
35
26
  | h-wtree | Git worktree management |
36
27
 
@@ -44,13 +35,9 @@ The main `h` command includes these built-in subcommands:
44
35
  | `h ping` | Simple test command (returns "pong") |
45
36
  | `h setup` | Install plugins and subcommands to system paths |
46
37
  | `h edit` | Open the h script in your editor |
47
- | `h path` | Print the current directory |
48
- | `h ppath` | Print project path (git root + relative dir) |
49
- | `h rpath` | Print relative path from git root |
50
- | `h pin` | Per-command key-value storage (via Pins plugin) |
51
- | `h project` | Project navigation with tmux integration (via Project plugin) |
52
- | `h task` | Task management across git worktrees (via Task plugin) |
53
- | `h notify` | macOS desktop notifications via terminal-notifier (via Notify plugin) |
38
+ | `h alert` | macOS desktop notifications via terminal-notifier |
39
+ | `h task` | Task management across git worktrees (via Tasks plugin) |
40
+ | `h subtask` | Subtask management within tasks (via Tasks plugin) |
54
41
 
55
42
  ## Plugins
56
43
 
@@ -58,8 +45,7 @@ The main `h` command includes these built-in subcommands:
58
45
  |--------|-------------|
59
46
  | Pins | Per-command YAML key-value storage |
60
47
  | Project | Project directory navigation with tmux session management |
61
- | Task | Task lifecycle management across git worktrees with subtask support |
62
- | Tmux | Tmux session helpers used by Project and Task |
48
+ | Tasks | Task lifecycle management across git worktrees with subtask support |
63
49
  | Notify | macOS desktop notifications via terminal-notifier |
64
50
 
65
51
  ## Abbreviations
@@ -69,5 +55,5 @@ All commands support prefix abbreviation:
69
55
  ```sh
70
56
  h buf ls # h buffer ls
71
57
  h ses ls # h session ls
72
- h vid info # h video info
58
+ h win # h window
73
59
  ```