hiiro 0.1.347 → 0.1.348

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: d531f00467c20b27b2842925a0f03b6a004fa23418353f78e582c4825c401ac8
4
- data.tar.gz: 6ca47f84c177f5f7e3a0a9897015a4d5d8b6c099975b77985bacee9c6fcf9b1a
3
+ metadata.gz: 20a3fd56855ee92e8afd85441d4ba206d5b3efd4c02a1300f6d7d3e08c3c942d
4
+ data.tar.gz: 637f4edc0280bec7bc9a4fa9586dadd5ad91edc4fe4f5dc2af86cb0bd712f21d
5
5
  SHA512:
6
- metadata.gz: c83b9628190944ef4f4d0a5a3c75c50b11d5de1ffec93958d2781832528995fde443e516dfb47f5902b7546c28f68da3ff85d8ea95dddc283cf986931698bb96
7
- data.tar.gz: 851e36d0499ccaabd36c363b17d19816c66954d73e4f9ccaeac9b345cd5a55a6a86592c9c8f9318f9775c580488b81169fdc0919fe74819f02e3b383d35ba83e
6
+ metadata.gz: 39839806c55912e229c0f1fff787ae797c1a9263a1474dd7553b37a9375063513addb302050ef795c1da81662362a819e540632938352ab86daa7fc8c1e21067
7
+ data.tar.gz: f1e9690bc7ead770d11d884a0b7998ed6f1a6bb93245d9a22754769c20a1c71af965c5ad722a19af7d66099825b671f306c2e128b320bde315958d0f5b85341c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.348] - 2026-04-17
4
+
5
+ ### Added
6
+ - `h task path|tree|branch|session` now accept `-a/--all` to print one value per task; trailing positional args act as prefix filters (OR'd together)
7
+ - `h task name` — new subcommand; prints current task name (or selects via fuzzyfind), supports `-a` like the others
8
+ - `h task prune` — drops task records whose worktree dir is missing; dry-run by default, requires `-f` to actually delete
9
+ - `TaskManager#filter_tasks(prefixes)` helper for sorted, prefix-filtered task lists
10
+
3
11
  ## [0.1.347] - 2026-04-12
4
12
 
5
13
  ### Added
data/docs/h-task.md CHANGED
@@ -41,11 +41,21 @@ h task apps
41
41
 
42
42
  Print the git branch for a task. With no argument, opens a fuzzyfind selector. Outputs nothing if the tree is detached.
43
43
 
44
+ **Options**
45
+
46
+ | Flag | Short | Description | Default |
47
+ |------|-------|-------------|---------|
48
+ | `--task` | `-t` | Task name | current task |
49
+ | `--find` | `-f` | Choose task interactively | false |
50
+ | `--all` | `-a` | Print branch for every task; positional args become prefix filters (OR'd) | false |
51
+
44
52
  **Examples**
45
53
 
46
54
  ```bash
47
55
  h task branch
48
56
  h task branch my-feature
57
+ h task branch -a # print branch for every task
58
+ h task branch -a feat bug # tasks whose name starts with "feat" or "bug"
49
59
  ```
50
60
 
51
61
  ---
@@ -186,6 +196,7 @@ Print the absolute path to a task's worktree or app subdirectory. With glob patt
186
196
  |------|-------|-------------|---------|
187
197
  | `--task` | `-t` | Task name | current task |
188
198
  | `--find` | `-f` | Choose task interactively | false |
199
+ | `--all` | `-a` | Print path for every task; positional args become prefix filters (OR'd). App / glob args are ignored in this mode. | false |
189
200
 
190
201
  **Examples**
191
202
 
@@ -194,6 +205,27 @@ h task path
194
205
  h task path my-feature
195
206
  h task path my-feature api
196
207
  h task path my-feature api "**/*.rb"
208
+ h task path -a # print worktree path for every task
209
+ h task path -a feat bug # tasks whose name starts with "feat" or "bug"
210
+ ```
211
+
212
+ ---
213
+
214
+ ### prune
215
+
216
+ Drop task records whose worktree directory is missing on disk. Useful after deleting worktrees out-of-band (e.g. `git worktree remove` on stale branches). Defaults to a dry-run; pass `-f` to actually remove.
217
+
218
+ **Options**
219
+
220
+ | Flag | Short | Description | Default |
221
+ |------|-------|-------------|---------|
222
+ | `--force` | `-f` | Actually delete (default is dry-run) | false |
223
+
224
+ **Examples**
225
+
226
+ ```bash
227
+ h task prune # show what would be pruned
228
+ h task prune -f # actually remove the missing-worktree task records
197
229
  ```
198
230
 
199
231
  ---
@@ -270,15 +302,46 @@ h task service start my-rails
270
302
 
271
303
  ---
272
304
 
305
+ ### name
306
+
307
+ Print the full task name. With no argument, opens a fuzzyfind selector. Useful for scripting alongside `tree -a`, `branch -a`, and `path -a` (results are sorted by name across all four, so they line up).
308
+
309
+ **Options**
310
+
311
+ | Flag | Short | Description | Default |
312
+ |------|-------|-------------|---------|
313
+ | `--task` | `-t` | Task name | current task |
314
+ | `--find` | `-f` | Choose task interactively | false |
315
+ | `--all` | `-a` | Print every task's name; positional args become prefix filters (OR'd) | false |
316
+
317
+ **Examples**
318
+
319
+ ```bash
320
+ h task name -a # list every task name
321
+ h task name -a feat # only tasks starting with "feat"
322
+ paste <(h task name -a) <(h task path -a) # name <-> path mapping
323
+ ```
324
+
325
+ ---
326
+
273
327
  ### session
274
328
 
275
329
  Print the tmux session name for a task. With no argument, opens a fuzzyfind selector.
276
330
 
331
+ **Options**
332
+
333
+ | Flag | Short | Description | Default |
334
+ |------|-------|-------------|---------|
335
+ | `--task` | `-t` | Task name | current task |
336
+ | `--find` | `-f` | Choose task interactively | false |
337
+ | `--all` | `-a` | Print session name for every task; positional args become prefix filters (OR'd) | false |
338
+
277
339
  **Examples**
278
340
 
279
341
  ```bash
280
342
  h task session
281
343
  h task session my-feature
344
+ h task session -a
282
345
  ```
283
346
 
284
347
  ---
@@ -448,11 +511,21 @@ h task todo done 0
448
511
 
449
512
  Print the worktree name for a task. With no argument, opens a fuzzyfind selector.
450
513
 
514
+ **Options**
515
+
516
+ | Flag | Short | Description | Default |
517
+ |------|-------|-------------|---------|
518
+ | `--task` | `-t` | Task name | current task |
519
+ | `--find` | `-f` | Choose task interactively | false |
520
+ | `--all` | `-a` | Print tree name for every task; positional args become prefix filters (OR'd) | false |
521
+
451
522
  **Examples**
452
523
 
453
524
  ```bash
454
525
  h task tree
455
526
  h task tree my-feature
527
+ h task tree -a
528
+ h task tree -a feat bug
456
529
  ```
457
530
 
458
531
  ---
data/lib/hiiro/tasks.rb CHANGED
@@ -257,6 +257,16 @@ class Hiiro
257
257
  switch_to_task(task)
258
258
  end
259
259
 
260
+ # Return tasks (sorted by name) optionally narrowed by prefix matches.
261
+ # Each prefix matches if a task's name (or short_name in subtask scope)
262
+ # starts with it. Multiple prefixes are OR'd together.
263
+ def filter_tasks(prefixes = [])
264
+ key = (scope == :subtask) ? :short_name : :name
265
+ list = (scope == :subtask ? tasks : environment.all_tasks)
266
+ list = list.select { |t| prefixes.any? { |p| t.public_send(key).start_with?(p) } } if prefixes.any?
267
+ list.sort_by(&key)
268
+ end
269
+
260
270
  def list(tags_filter: [])
261
271
  tag_store = Hiiro::Tags.new(:task)
262
272
  items = tasks
@@ -812,6 +822,7 @@ class Hiiro
812
822
  task_opts_block = proc {
813
823
  option(:task, short: :t, desc: 'Task name')
814
824
  flag(:find, short: :f, desc: 'Choose task interactively')
825
+ flag(:all, short: :a, desc: 'Operate on all tasks (positional args = prefix filters)')
815
826
  }
816
827
 
817
828
  h.add_subcmd(:list) do |*args|
@@ -1048,6 +1059,15 @@ class Hiiro
1048
1059
 
1049
1060
  h.add_subcmd(:path) do |*raw_args|
1050
1061
  opts = Hiiro::Options.parse(raw_args, &task_opts_block)
1062
+
1063
+ if opts.all
1064
+ tm.filter_tasks(opts.args).each do |task|
1065
+ path = tm.resolve_path(task)
1066
+ puts path if path
1067
+ end
1068
+ next
1069
+ end
1070
+
1051
1071
  task, positional = resolve_task.call(opts, opts.args)
1052
1072
  unless task
1053
1073
  STDERR.puts "No task found"
@@ -1080,17 +1100,26 @@ class Hiiro
1080
1100
  end
1081
1101
  end
1082
1102
 
1083
- h.add_subcmd(:branch) do |task_name=nil|
1084
- print tm.value_for_task(task_name, &:branch)
1085
- end
1086
-
1087
- h.add_subcmd(:tree) do |task_name=nil|
1088
- print tm.value_for_task(task_name, &:tree_name)
1103
+ # Helper for branch/tree/session/name: when -a is set, print one
1104
+ # value per matching task; otherwise behave like the original
1105
+ # single-task lookup (positional task name or fuzzyfind).
1106
+ print_task_value = lambda do |raw_args, attr|
1107
+ opts = Hiiro::Options.parse(raw_args, &task_opts_block)
1108
+ if opts.all
1109
+ tm.filter_tasks(opts.args).each do |t|
1110
+ val = t.public_send(attr)
1111
+ puts val if val
1112
+ end
1113
+ else
1114
+ task_name = opts.task || opts.args.first
1115
+ print tm.value_for_task(task_name) { |t| t.public_send(attr) }
1116
+ end
1089
1117
  end
1090
1118
 
1091
- h.add_subcmd(:session) do |task_name=nil|
1092
- print tm.value_for_task(task_name, &:session_name)
1093
- end
1119
+ h.add_subcmd(:branch) { |*raw_args| print_task_value.call(raw_args, :branch) }
1120
+ h.add_subcmd(:tree) { |*raw_args| print_task_value.call(raw_args, :tree_name) }
1121
+ h.add_subcmd(:session) { |*raw_args| print_task_value.call(raw_args, :session_name) }
1122
+ h.add_subcmd(:name) { |*raw_args| print_task_value.call(raw_args, :name) }
1094
1123
 
1095
1124
  h.add_subcmd(:current) do
1096
1125
  task = tm.current_task
@@ -1147,6 +1176,38 @@ class Hiiro
1147
1176
 
1148
1177
  h.add_subcmd(:save) { tm.save }
1149
1178
 
1179
+ h.add_subcmd(:prune) do |*raw_args|
1180
+ opts = Hiiro::Options.parse(raw_args) {
1181
+ flag(:force, short: :f, desc: 'Actually delete (default is dry-run)')
1182
+ }
1183
+
1184
+ to_remove = tm.environment.all_tasks.select do |task|
1185
+ next true unless task.tree_name
1186
+ path = tm.resolve_path(task)
1187
+ path.nil? || !Dir.exist?(path)
1188
+ end
1189
+
1190
+ if to_remove.empty?
1191
+ puts "No tasks to prune"
1192
+ next
1193
+ end
1194
+
1195
+ to_remove.each do |task|
1196
+ path = task.tree_name ? tm.resolve_path(task) : '(no tree)'
1197
+ if opts.force
1198
+ tm.config.remove_task(task.name)
1199
+ puts "Pruned: #{task.name} (#{path})"
1200
+ else
1201
+ puts "Would prune: #{task.name} (#{path})"
1202
+ end
1203
+ end
1204
+
1205
+ unless opts.force
1206
+ puts
1207
+ puts "Re-run with -f to actually delete."
1208
+ end
1209
+ end
1210
+
1150
1211
  h.add_subcmd(:color) do
1151
1212
  task = tm.current_task
1152
1213
  unless task
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.347"
2
+ VERSION = "0.1.348"
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.347
4
+ version: 0.1.348
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota