hiiro 0.1.365 → 0.1.367

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: 5cd9e9d71bc395bd2c2595f8087e46f1ba6ea4e5ec80ae9ea9be9942aeddc15a
4
- data.tar.gz: 96f39bc0fe91064bb6a7c95371b7d1105be32daad17883e5a75ec565a617783c
3
+ metadata.gz: 9f4708a4c90c2b72668cc5f42c6a28ad1b06c5833986e45eb547e8215f6ec64e
4
+ data.tar.gz: e870242d4e60b6dd633a280733456ade72d0cdf999b733e39223cbf46647dd2f
5
5
  SHA512:
6
- metadata.gz: ff2f56ae6f5c69db4476308c1f52eff96504b8ce52b8fb1d015a4ade478e3000e075ac0e8a737d2fc03b9bb16108ba6408ca7eb22af76965780addf528f94758
7
- data.tar.gz: f15c1f626b4c6b7ffccfc62559517a35d75a0f0e10ac1a72601401b7b953231ec2e9df4495946c9724d46d7ce3d2d9d2b26826f4f4119dfadf80041935288c75
6
+ metadata.gz: 184881124f6711f940214c20510527d1790c800ea56e3e3b37b74a7060f71aeb564300b12179419cf0ec0099a041df6189ddb41137f132b5c0e0b4f691742572
7
+ data.tar.gz: 1372760dfa76e22fe9305c83c826b72fd2f0e2328b2cd6c0c41f0b1f8baf23720460c150aeb66c434bd666a8779a49f40a7d2338482216dc8edc9bf89a2d1b40
data/CHANGELOG.md CHANGED
@@ -1,5 +1,58 @@
1
1
  # Changelog
2
2
 
3
+ ## [Unreleased]
4
+
5
+ ## [0.1.367] - 2026-09-14
6
+
7
+ ### Added
8
+ - Add `h env add NAME VALUE` and `h alias add NAME COMMAND...` to append safely quoted shell definitions, preferring existing zsh module files and falling back to the root dotfiles. Use native Hiiro options, including `opts.global` and `--`.
9
+ - Add `h bin add NAME [COMMAND ...]` to generate executable `Hiiro.run` templates with optional empty `add_cmd` blocks. Serialize command names as Ruby symbols and refuse existing files or symlinks.
10
+ - `t ls` and `t list` root commands list tasks like bare `t`
11
+ - `Hiiro::Error`: `Hiiro#run` prints only `ERROR: message` for it, no backtrace
12
+ - `builtin_commands: false` option for `Hiiro.run`/`run_child` to skip the automatic `pry` and `edit` commands
13
+ - `Hiiro#open_default(target)` opens a path or URL with `open`/`xdg-open`
14
+ - `t` and `tt` are gem executables (`exe/t`, `exe/tt`) installed with Hiiro
15
+ - `t TASK tree new|rm|resume`, `t TASK tree`, `t TASK path`, `t TASK branch`, `t TASK sh`, and `t TASK cd` bring worktree and shell commands from `h task` into `t`; subtasks are `parent/child` names
16
+ - `Hiiro::CurrentTask`: one resolver for the current task (Herdr workspace, working directory, saved pin) used by `t` and by `Environment#task`
17
+ - `Hiiro::Git.repo_dir` so worktree commands work when `~/work/.git` is a gitfile pointing at the bare repo
18
+
19
+ ### Fixed
20
+ - `h task start` and worktree listing failed with "Not a directory" when `~/work/.git` is a gitfile; git now runs in the parent directory
21
+
22
+ ### Changed
23
+ - Move the task CLI into `lib/hiiro/task_cli.rb` (`Hiiro::TaskCli`); `exe/t` and `exe/tt` are thin `Hiiro.run` launchers and `bin/t`, `bin/tt` are symlinks
24
+ - `t` requires `hiiro` like other bins instead of editing the load path; `task_scope` and `task_sessions` load with `hiiro`
25
+ - `t` errors print without a backtrace; task, scope, and session errors subclass `Hiiro::Error`
26
+ - `t` saves the current task through the `PinRecord` model and resolves resources, documents, tabs, and panes with `Hiiro::Matcher`, accepting unique prefixes and offering fuzzyfind when no reference is given
27
+ - `tt` runs the todo scope in-process instead of exec'ing `t`
28
+ - `h task` is now a symlink to `t` (`bin/h-task` -> `exe/t`); the inline `h task` and `h subtask` subcommands are gone, and `h task start|stop|resume|switch|sh|cd|path|branch|todo` map to `t` commands (see docs/h-task.md)
29
+ - `Environment#task` also matches the working directory against task homes, primary directories, and registered directories
30
+ - `TaskManager#start_task` uses the extracted `create_tree`
31
+ - Task listing prints aligned columns with the open todo count after each name, e.g. `prez (3)`, plus `next:`/`waiting:` text
32
+ - `ls` and `list` are now reserved root words in `t`; tasks with those exact names need a unique prefix
33
+
34
+ ## [0.1.366] - 2026-09-14
35
+
36
+ ### Changed
37
+ - Implement task-first CLI syntax: `t TASK COMMAND...` replaces `t COMMAND [TASK]...`
38
+ - Task names now precede commands, appearing immediately after `t` or after a group
39
+ - Task resolution prefers exact names, then unique case-sensitive prefixes; ambiguous prefixes fail
40
+ - Move workspace command from `t workspace TASK` to `t TASK switch` (keep `workspace` as alias)
41
+ - Rename implicit task selection to explicit `.` reference; bare `t` lists all tasks without selecting
42
+ - Update `t current TASK` to `t TASK current`; explicit named selections save fallback after success
43
+ - Context resolution checks calling Herdr workspace, then current directory, then saved task; reject ambiguous matches
44
+
45
+ ### Added
46
+ - Task todo management under `t TASK todo` with `add`, `rm`, `list`/`ls` subcommands; todos share existing database with `h todo`
47
+ - `tt TASK ...` shortcut delegates to `t TASK todo ...`; bare `tt` uses current task via `.` selection
48
+ - Orphan todo scope with `t - todo` and `tt -` for unassigned todos; `-` invalid outside todo commands
49
+ - Native AI session launches via `t TASK omp`, `codex`/`cdx`, and `claude`/`cld` for fresh tool instances
50
+ - Resume mode with first-argument prefix matching (e.g., `r`, `res`, `resume`); focuses unique running instance or launches native picker
51
+ - `Hiiro::TaskScope` library for named/current/orphan task reference resolution with cached context
52
+ - `Hiiro::TaskSessions` library for AI tool launch/resume dispatch with Herdr workspace integration
53
+ - New `lib/hiiro/task_scope.rb` and `lib/hiiro/task_sessions.rb` support libraries
54
+ - New `bin/tt` executable for todo shortcut
55
+
3
56
  ## [0.1.365] - 2026-09-13
4
57
 
5
58
  ### Added
@@ -27,346 +80,3 @@
27
80
  - Restore the missing `Hiiro::Bins` helper so `require "hiiro"` boots and commands like `h jumplist record` dispatch correctly.
28
81
  - Make Hiiro's Ruby requirement explicit as Ruby 3.2+ and have rbenv-wide gem installs skip incompatible Ruby versions.
29
82
  - Update the publish script to preserve the Ruby support constant, run only on supported Ruby, and install releases only into compatible rbenv versions.
30
-
31
- ## [0.1.364] - 2026-09-13
32
-
33
- ### Fixed
34
- - Create the publish response log directory before saving Claude's output, preventing release preparation from failing when the directory is absent.
35
- - Prevent infinite recursion in help directory grouping when command locations span different filesystem-root directories, such as `/Users` and `/Volumes`.
36
-
37
- ## [0.1.355] - 2026-05-19
38
-
39
- ### Added
40
- - `h task from <worktree-path> <task-name>` registers an existing git worktree from any path as a Hiiro task and switches to it.
41
-
42
- ### Fixed
43
- - `h task list` now shows external tasks registered with slash-containing names like `menu/ids`.
44
-
45
- ## [0.1.353] - 2026-04-26
46
-
47
- ### Added
48
- - `Hiiro::Tui::ListScreen` for building keyboard-driven full-screen list interfaces
49
- - `Hiiro::Config.load_yaml` and `Hiiro::Config.yaml_dig` helpers for YAML file loading with nested key access
50
-
51
- ## [0.1.352] - 2026-04-24
52
-
53
- ### Added
54
- - `h claude all|agents|commands|skills` now support `--absolute/-a` to print absolute tool paths; skill matches resolve to `SKILL.md`
55
-
56
- ### Fixed
57
- - `h capture path <num>` now prints the path of the Nth most recent capture (was always printing the captures dir regardless of args)
58
- - `h capture new` / `h capture file` now record to the DB even when interrupted (Ctrl-C, exception) so partial captures show up in `h capture ls`. Interrupted captures display with the existing `?` glyph and `(exit interrupted)` message.
59
- - `h pane splitv/splith` subcommand mappings corrected
60
- - Corrected `REPO_PATH` constant from `.bare` to `.git`
61
-
62
- ## [0.1.350] - 2026-04-18
63
-
64
- ### Added
65
- - `h-capture` command and `Hiiro::Capture` module for clipboard/selection capture
66
-
67
- ### Changed
68
- - Optimize `Hiiro::Shell::Result#plain_text` and `#lines` with instance-level caching
69
- - Refactor `Shell::Result#lines` to use `String#lines(chomp: true)` for improved line handling
70
- - Reduce Claude API effort to `low` in publish script for faster changelog generation
71
-
72
- ## [0.1.349] - 2026-04-17
73
-
74
- ### Removed
75
- - `h task branches` and `h task wtrees` convenience subcommands; use `h branch` and `h wtree` directly instead
76
-
77
- ## [0.1.348] - 2026-04-17
78
-
79
- ### Added
80
- - `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)
81
- - `h task name` — new subcommand; prints current task name (or selects via fuzzyfind), supports `-a` like the others
82
- - `h task prune` — drops task records whose worktree dir is missing; dry-run by default, requires `-f` to actually delete
83
- - `TaskManager#filter_tasks(prefixes)` helper for sorted, prefix-filtered task lists
84
-
85
- ## [0.1.347] - 2026-04-12
86
-
87
- ### Added
88
- - `h pr tags` now supports flags: `--update/-u` (refresh PR status before listing), `--verbose/-v` (multi-line output per PR), `--checks/-C` (show individual check run details)
89
-
90
- ## [0.1.346] - 2026-04-12
91
-
92
- ### Added
93
- - `h pr tags` now accepts optional tag names to filter output to only those tags
94
-
95
- ## [0.1.345] - 2026-04-12
96
-
97
- ### Fixed
98
- - ANSI escape sequence pattern now uses hex escapes (`\x20-\x2f`) instead of literal space-to-slash to avoid ambiguity with the `/` regex delimiter
99
-
100
- ## [0.1.343] - 2026-04-12
101
-
102
- ### Added
103
- - Task subcommands now fall back to `~/proj/*` directories when no task matches
104
- - `h task path hiiro` → resolves to `~/proj/hiiro` if no task named "hiiro" exists
105
- - Works for: `cd`, `path`, `sh`, `branch`, `tree`, `session`, and any subcommand using `-t` flag
106
- - `FallbackTarget` class duck-types as `Task` for seamless integration
107
- - Ambiguous project matches print a warning to stderr
108
-
109
- ### Fixed
110
- - `Hiiro::Git::Pr.is_link?` is now a class method (was instance method)
111
-
112
- ## [0.1.342] - 2026-04-08
113
-
114
- ### Added
115
- - `h pr review` / `h pr cr` — code review workflow for managing PR sessions in ~/work/codereviews worktree
116
- - `Hiiro::Git::Pr.from_link(url)` — parse PR number, owner, and repo from GitHub PR links
117
- - `Hiiro::Git::Pr.from_number(number)` — create PR instances from PR numbers
118
- - `Hiiro::Git::Pr.is_link?(link)` — validate GitHub PR links
119
-
120
- ## [0.1.341] - 2026-04-07
121
-
122
- ### Fixed
123
- - `h pr view` now defaults to current branch's PR when no PR number is specified
124
-
125
- ### Changed
126
- - Update publish script to use `claude-haiku-4-5` model identifier
127
-
128
- ## [0.1.340] - 2026-04-07
129
-
130
- ### Fixed
131
- - `h notify jump` now runs `switch-client` before `select-window`/`select-pane` so jumping to a pane in a different session actually works
132
- - `h notify ls` and `h notify menu` now auto-prune stale entries for panes that no longer exist
133
-
134
- ### Added
135
- - `h notify prune` — explicitly remove all notifications for dead panes
136
-
137
- ## [0.1.339] - 2026-04-07
138
-
139
- ### Added
140
- - `h ps byport <port> [port2 ...]` — find processes listening on specified port(s)
141
- - `PsProcess.by_port(*ports)` — query processes by listening port numbers
142
- - `h task switch` now matches ~/proj/* directories by prefix as fallback when task name doesn't match
143
-
144
- ## [0.1.338] - 2026-04-07
145
-
146
- ### Changed
147
- - `h pr watch`, `h pr fwatch`, `h pr check` now default to current branch's PR (use `-s` to select via fuzzyfinder)
148
- - Renamed `registry_entries` table to `registry` (auto-migrates existing data)
149
-
150
- ## [0.1.337] - 2026-04-06
151
-
152
- ### Changed
153
- - Refactor `PsProcess#files` and `PsProcess#ports` to use `filter_map` instead of `map + compact` for cleaner code
154
-
155
- ## [0.1.336] - 2026-04-06
156
-
157
- ### Fixed
158
- - `PsProcess#ports` now uses `lsof -a` to AND conditions (was showing all system ports)
159
-
160
- ## [0.1.335] - 2026-04-07
161
-
162
- ### Added
163
- - New `Hiiro::PsProcess` class (`lib/hiiro/ps_process.rb`) for encapsulated process info:
164
- - `PsProcess.from_line(line)` - parse `ps awwux` output
165
- - `PsProcess.all`, `.search(pattern)`, `.find(pid)`, `.in_dirs(*paths)`
166
- - Instance methods: `#files`, `#ports`, `#dir`, `#parent`, `#children`
167
- - Simple `#to_s` output: PID + CMD
168
- - New `h ps` subcommands: `info`, `files`, `ports`
169
- - Smart argument resolution in `h ps`: accepts PID, search pattern, or directory path
170
-
171
- ### Changed
172
- - Refactored `h-ps` to use `PsProcess` class instead of raw `ps` parsing
173
-
174
- ## [0.1.334] - 2026-04-07
175
-
176
- ### Added
177
- - New `h-ps` bin file for process utilities:
178
- - `search <pattern>` - find processes matching a substring
179
- - `indir <path> [path2 ...]` - list processes with files open in specified paths
180
- - `getdir <pattern>` - list working directories of processes matching pattern
181
-
182
- ## [0.1.333] - 2026-04-04
183
-
184
- ### Changed
185
- - Display hiiro version in queue watch output for better visibility during task monitoring
186
-
187
- ## [0.1.332] - 2026-04-04
188
-
189
- ### Changed
190
- - Extract `hiiro_version` helper method in queue watcher to reduce duplication and improve version detection reliability
191
-
192
- ## [0.1.331] - 2026-04-04
193
-
194
- ### Fixed
195
- - Strip whitespace from gem version output in queue watcher to prevent version comparison failures
196
-
197
- ## [0.1.330] - 2026-04-04
198
-
199
- ### Added
200
- - `h queue add` now supports tmux session name prefix matching as fallback when task name doesn't match
201
- - Queue editor now opens from the session's active pane directory when adding tasks via session reference
202
-
203
- ### Changed
204
- - Extract `session_info_for()` helper to resolve tmux sessions by prefix in queue prompt resolver
205
-
206
- ## [0.1.329] - 2026-04-03
207
-
208
- ### Changed
209
- - Add debug output and temporary JSON logging to publish script for troubleshooting Claude API responses
210
-
211
- ## [0.1.328] - 2026-04-02
212
-
213
- ### Changed
214
- - Update command documentation
215
-
216
- ## [0.1.327] - 2026-04-02
217
-
218
- ### Added
219
- - `h branch save --tag <tag>` (repeatable) — apply tags to branches during save operation
220
-
221
- ## [0.1.326] - 2026-04-02
222
-
223
- ### Changed
224
- - Improve tag display formatting in link output by mapping individual tags to colored badges
225
- - Refactor `h link tags` filtering logic to use `Hiiro::Tag` helpers for cleaner code
226
- - Relocate `taggable` accessor method in `Hiiro::Tag` model
227
-
228
- ### Added
229
- - `Hiiro::Tag.tagged_by_type` helper method to query tagged objects by tag name and type
230
-
231
- ## [0.1.325] - 2026-04-02
232
-
233
- ### Fixed
234
- - Allow custom primary keys in `Hiiro::Invocation` model via `unrestrict_primary_key` for SQLite compatibility
235
-
236
- ## [0.1.324] - 2026-04-02
237
-
238
- ### Added
239
- - `h pr status [ref...]` — query multiple PRs or pinned PRs; outputs number, title, state, check summary, and URL for each
240
- - `h wtree branch [paths...]` — show branch for each worktree, or query specific worktree paths; resolves relative paths using task context
241
-
242
- ### Changed
243
- - Pass `cwd` context to `h-wtree` via `Hiiro.run` for proper path resolution in nested environments
244
-
245
- ## [0.1.323] - 2026-04-01
246
-
247
- ### Changed
248
- - Simplify `h pr ls` status refresh logic: always call `refresh_all_status` with `force:` parameter instead of conditional block
249
- - Add optional `verbose:` parameter to `refresh_all_status` to control "already checked" message output
250
- - Update `h pr update` to pass `verbose: true` when refreshing active PR status
251
-
252
- ## [0.1.322] - 2026-04-01
253
-
254
- ### Changed
255
- - Refactor `h link tags` filtering logic to use new `Hiiro::Tag.tags_by_type` helper
256
- - Simplify tag query to use `Hiiro::Link.where(id:)` instead of manual filtering
257
- - Extract `tags_by_type(type)` singleton method to `Hiiro::Tag` for code reuse
258
-
259
- ## [0.1.321] - 2026-04-01
260
-
261
- ### Changed
262
- - Extract `open_config` to `Hiiro::Config.open` singleton method; simplify parameter order from `dir:, file:` to positional `file, dir: nil`
263
- - Update all config subcommands to use new `Hiiro::Config.open` interface
264
-
265
- ## [0.1.320] - 2026-04-01
266
-
267
- ### Changed
268
- - Extract `open_config` helper to Hiiro instance method for reuse across config subcommands
269
- - Refactor `h version --all` to use `Hiiro::Rbenv.capture` with clearer output formatting
270
- - Add `to_s` method to `Hiiro::Tmux::Session` for string representation; rename existing `display` method for consistency
271
- - Extract `project_dirs` and `projects_from_config` to singleton methods in Project plugin for testability
272
-
273
- ## [0.1.319] - 2026-04-01
274
-
275
- ### Added
276
- - `h queue ls [STATUS]` — filter by status with prefix matching (e.g. `h queue ls run` → running tasks); composable with existing `-s` flag
277
- - `h session sh <session> [cmd...]` — open a new window in another tmux session (runs shell or given command there, then switches)
278
- - `h task sh -s SESSION [cmd...]` — run task shell/command in a new window in a specific tmux session
279
- - `h link tags` — list all known link tags; `h link tags tag1 tag2...` filters links by tags (prefix matching)
280
- - `h link ls` now shows tags inline with colored badges
281
- - `h link rm` / `h link remove` subcommand — remove links by number, shorthand, or fuzzy select
282
-
283
- ### Fixed
284
- - `h pr update` and `h pr ls -u` skip closed/merged PRs — only active PRs are refreshed
285
- - `h link add -h` now shows help instead of adding `-h` as a URL
286
- - `h db remigrate` no longer imports duplicate links — skips rows with an already-existing URL
287
- - Add unique constraint on `links.url` to prevent duplicates at database level
288
-
289
- ## [0.1.318] - 2026-04-01
290
-
291
- ### Added
292
- - `registry_pick` helper method for interactive registry entry selection via fuzzyfinder
293
-
294
- ### Changed
295
- - Simplify gem installation logic: always use `gem install -u` instead of checking installation state and branching between `gem install` and `gem update`
296
- - Remove `--clear-sources` and `--source` flags in favor of gem's built-in source cache handling
297
- - Improve gem version regex in publish script to match only the first (latest) version from `gem list` output
298
-
299
- ### Fixed
300
- - Ensure gem installation works reliably across all rbenv Ruby versions by using `-u` flag for consistent update behavior
301
-
302
- ## [0.1.317] - 2026-04-01
303
-
304
- ### Changed
305
- - Parallelize gem installation across all rbenv Ruby versions using thread pool for faster multi-version deployment
306
- - Refactor publish script to install/update hiiro gem across all Ruby versions instead of just current version
307
-
308
- ### Fixed
309
- - Handle both gem install and update cases based on existing installation state
310
- - Run `h setup` after installation in each Ruby version to initialize version-specific configuration
311
- - Suppress gem installation output to reduce log noise during parallel installs
312
-
313
- ## [0.1.316] - 2026-04-01
314
-
315
- ### Added
316
- - Parallelize hiiro gem updates across Ruby versions with thread pool for faster multi-version updates
317
- - Optional `dir:` parameter to `Hiiro::Background.run` for working directory support
318
-
319
- ### Changed
320
- - Improve gem version regex pattern in publish script for more reliable version matching
321
-
322
- ### Fixed
323
- - Bypass rubygems local cache with `--clear-sources --source https://rubygems.org` flags in `install_gem` to ensure fresh gem installation
324
- - Add debug output for version polling in publish script
325
- - Convert `sa` symlink from absolute to relative path
326
-
327
- ## [0.1.315] - 2026-04-01
328
-
329
- ### Fixed
330
- - Remove redundant `exit 0` statement from publish script
331
-
332
- ## [0.1.314] - 2026-04-01
333
-
334
- ### Fixed
335
- - Rename `Gem` class to `RubyGem` in publish script to avoid conflict with Ruby stdlib
336
-
337
- ## [0.1.313] - 2026-04-01
338
-
339
- ### Fixed
340
- - Remove `awesome_print` dependency
341
- - Do not splice values into subcommand constructor; pass them as keyword arguments to prevent arg leakage
342
-
343
- ## [0.1.312] - 2026-04-01
344
-
345
- ### Fixed
346
- - Separate `bin_name` and `args` initialization in `Hiiro.init` to prevent argument confusion in nested Hiiro instances
347
-
348
- ## [0.1.311] - 2026-04-01
349
-
350
- ### Changed
351
- - Add `ap()` inspection for bin/args initialization in debug mode
352
-
353
- ## [0.1.310] - 2026-04-01
354
-
355
- ### Fixed
356
- - `make_child` now passes `bin_name:` and `args:` as keyword args to `Hiiro.init`, fixing subcommand dispatch for all `h task`, `h queue`, `h service`, and `h run` child hierarchies — previously `child_bin_name` leaked into `oargs` and became the subcmd, so every child hiiro showed help instead of dispatching
357
-
358
- ## [0.1.309] - 2026-03-31
359
-
360
- ### Added
361
- - `h link tag` support for tagging links in the link manager
362
-
363
- ### Fixed
364
- - Correct argument passing in `run_child` to prevent arg dropping in nested Hiiro instances
365
-
366
- ## [0.1.308] - 2026-03-31
367
-
368
- ### Added
369
- - `h db cleanup` subcommand to preview and prune duplicate rows from SQLite tables
370
-
371
- ### Fixed
372
- - Prevent duplicate pinned_prs during import with `insert_conflict` and per-row rescue
data/CLAUDE.md CHANGED
@@ -508,6 +508,7 @@ ALWAYS update `README.md` and any files in `docs/` or other markdown files that
508
508
  ## Key Files
509
509
 
510
510
  - `exe/h` - Entry point that loads lib/hiiro.rb
511
+ - `exe/t`, `exe/tt` - Task CLI launchers over `Hiiro::TaskCli` (`lib/hiiro/task_cli.rb`)
511
512
  - `bin/h-*` - External subcommands (tmux wrappers, git helpers, jumplist, etc.)
512
513
  - `plugins/*.rb` - Reusable plugin modules (Pins, Project, Tasks, Notify)
513
514
  - `lib/hiiro.rb` - Main Hiiro class and Runners
data/README.md CHANGED
@@ -61,20 +61,74 @@ h ping
61
61
 
62
62
  ### Task CLI
63
63
 
64
- `~/bin/t` contains the task commands and helpers, using Hiiro's `add_cmd` DSL
65
- and existing task records. `t new NAME` creates a task and its notes directory
66
- without creating a Git worktree. Select a task with `--task NAME` or `-t NAME`.
67
- Root and group help are generated by Hiiro; leaf command help lists its selected options.
64
+ `t` and `tt` are gem executables in `exe/`, installed alongside `h`. They are thin
65
+ `Hiiro.run` launchers over `Hiiro::TaskCli` in `lib/hiiro/task_cli.rb`, which uses
66
+ the `add_cmd` DSL and existing task records. `bin/t` and `bin/tt` are symlinks to
67
+ the `exe/` files for running from a checkout with `ruby -Ilib bin/t`. `t NAME new`
68
+ creates a task and its notes directory without creating a Git worktree.
69
+
70
+ Use `t TASK COMMAND...`. Bare `t`, `t ls`, or `t list` lists every task, including
71
+ done and archived tasks, with the count of open todos after each name. `t TASK`
72
+ shows a task. Only exact root `t help` displays generic usage and
73
+ native scoped help without looking up a task. Other first words are task
74
+ references, even `new`, `show`, `edit`, or `he`.
75
+
76
+ Task references prefer an exact name, then a unique case-sensitive prefix.
77
+ Ambiguous prefixes fail. `t NAME new` creates the exact name instead of resolving
78
+ a prefix. An unknown name is otherwise an error, except that `t NAME todo add`
79
+ can create the task with its first todo.
80
+
81
+ Use `.` for the current task. Selection checks the calling Herdr workspace,
82
+ then the current directory, then the saved task. Stale or ambiguous context is
83
+ an error. `t TASK current` saves a named selection without focusing a terminal;
84
+ `t . current` only prints it. `t TASK switch` and `t TASK workspace` focus or
85
+ create the task workspace and save a named selection only after success.
86
+ `--show` inspects without changing focus or the saved task.
68
87
 
69
88
  ```sh
70
- t new investigation
71
- t next -t investigation "Inspect the failing request"
72
- t doc new findings -t investigation
73
- t doc open findings -t investigation
74
- t show investigation
89
+ t investigation new
90
+ t investigation next "Inspect the failing request"
91
+ t investigation todo add Compare the retry settings
92
+ tt investigation add Inspect --help output
93
+ t investigation doc new findings
94
+ t investigation doc open findings
95
+ t investigation
96
+ t investigation todo rm 42 # Use an item ID printed by show or todo list.
97
+ t investigation current
98
+ t investigation switch
99
+ t investigation workspace --show
100
+ t . next "Write the handoff"
75
101
  ```
76
102
 
77
- See [Task commands](docs/h-task.md) for the full command reference.
103
+ A task has one `next_action` and can have multiple independent todos. `t TASK`
104
+ and `t TASK todo` print todos with their IDs, statuses, and text in ID order.
105
+ `t TASK todo rm ID` deletes only that exact decimal ID in the selected scope.
106
+ `tt TASK ...` delegates to `t TASK todo ...`; bare `tt` means `t . todo`, and
107
+ `tt help` displays todo help. Use `t - todo` or `tt -` for orphan todos, including
108
+ `add` and `rm`. `-` is not a task and is invalid outside todo commands.
109
+
110
+ Every argument after `todo add` is literal text, including flags and `--`,
111
+ except that leading `add -h` or `add --help` displays help. Empty text fails
112
+ without creating a task.
113
+
114
+ Todos share the existing `todos` table with `h todo`. `t` writes only to the
115
+ database and does not rewrite `todo.yml`. Adding or removing a todo does not
116
+ change the task's next action, status, or saved selection. Task completion and
117
+ archival preserve todos. `h task` is a symlink to `t`, so both share one grammar.
118
+
119
+ `t TASK omp`, `t TASK codex` or `cdx`, and `t TASK claude` or `cld` start fresh
120
+ native CLI sessions in new focused Herdr tabs. Claude always runs `claude`.
121
+ Only a nonempty prefix of `resume` as the first tool argument changes mode.
122
+ Bare `resume` focuses the unique running instance of that tool in the task
123
+ workspace, or launches the native resume picker if none is running. Multiple
124
+ running matches are an error. With an ID or any other arguments after `resume`,
125
+ the command always opens a new tab and passes those arguments to the native CLI.
126
+ All other arguments, including `--help`, are tool flags, not `t` flags.
127
+
128
+ Tasks can share an existing directory, including a worktree. `t` does not change
129
+ Git state or promise task-isolated persisted AI sessions in shared directories.
130
+
131
+ See the [task command reference](docs/t.md) for all commands and the [workflow introduction](docs/why-t.md) for practical examples.
78
132
 
79
133
  ## Subcommands
80
134
 
@@ -87,18 +141,20 @@ See [Task commands](docs/h-task.md) for the full command reference.
87
141
  | `h setup` | Install plugins and subcommands to system paths |
88
142
  | `h edit` | Open the h script in your editor |
89
143
  | `h alert` | macOS desktop notifications via terminal-notifier |
90
- | `h task` | Task management across git worktrees, including existing external worktrees (via Tasks plugin) |
91
- | `h subtask` | Subtask management within tasks (via Tasks plugin) |
144
+ | `h task` | Same program as `t`: task records, todos, worktrees (`t NAME tree new`), and Herdr workspaces |
92
145
 
93
146
  ### External Subcommands
94
147
 
95
148
  | Command | Description |
96
149
  |---------|-------------|
150
+ | `h alias` | Append safely quoted zsh aliases |
97
151
  | `h app` | Manage app directories within tasks/projects |
152
+ | `h bin` | Create, list, and edit Hiiro executables |
98
153
  | `h branch` | Git branch management with fuzzy selection and copy |
99
154
  | `h claude` | Claude CLI wrapper with Herdr split support |
100
155
  | `h commit` | Select commits using fuzzy finder |
101
156
  | `h config` | Open config files (vim, git, Herdr, zsh, starship, claude) |
157
+ | `h env` | Append safely quoted environment variables |
102
158
  | `h link` | Manage saved links with URL, description, and shorthand |
103
159
  | `h pane` | Herdr pane management |
104
160
  | `h plugin` | Manage hiiro plugins (list, edit, search) |
@@ -116,6 +172,33 @@ See [Task commands](docs/h-task.md) for the full command reference.
116
172
 
117
173
  `h claude agents|commands|skills -a` prints the absolute file path for each matching `.claude` tool, including `SKILL.md` for skills.
118
174
 
175
+ ### Shell helpers
176
+
177
+ ```sh
178
+ h env add exam ple
179
+ h alias add ll 'ls -al'
180
+ h alias add --global PAGER '| less'
181
+ h bin add scratch
182
+ h bin add josh list show
183
+ ```
184
+
185
+ `h env add NAME VALUE` appends a literal `export NAME="VALUE"` to
186
+ `~/.zshenv.d/vars.zsh` when that file exists, otherwise to `~/.zshenv`.
187
+ `h alias add NAME COMMAND...` similarly prefers `~/.zshrc.d/aliases.zsh`,
188
+ falling back to `~/.zshrc`. Existing contents are preserved. A single quoted
189
+ command string preserves shell syntax; separate command arguments retain their
190
+ argument boundaries. Use `--global` or `-g` for a global zsh alias.
191
+
192
+ These commands use native Hiiro option parsing and help. Use `--` before
193
+ flag-like data, for example `h env add LABEL -- --literal` or
194
+ `h alias add inspect -- tool --help`. Start a new shell or source the relevant
195
+ configuration file to apply additions.
196
+
197
+ `h bin add NAME [COMMAND ...]` creates an executable `~/bin/h-NAME` using
198
+ `Hiiro.run`. Without commands its block is empty; each command adds an empty
199
+ `add_cmd` block with a Ruby symbol. Existing files and symlinks are never
200
+ overwritten. See the [bin command reference](docs/h-bin.md).
201
+
119
202
  ## Abbreviations
120
203
 
121
204
  Any subcommand can be abbreviated as long as the prefix uniquely matches:
@@ -135,7 +218,7 @@ Plugins are Ruby modules loaded from `~/.config/hiiro/plugins/`:
135
218
  |--------|-------------|
136
219
  | Pins | Per-command YAML key-value storage |
137
220
  | Project | Project directory navigation with Herdr workspace management |
138
- | Tasks | Task lifecycle management across git worktrees with external-worktree registration and subtask support |
221
+ | Tasks | `Hiiro::TaskManager` worktree creation and current-task environment used by `t`, `h service`, `h run`, and `h file` |
139
222
  | Notify | Herdr desktop notifications |
140
223
 
141
224
  ## Adding Subcommands
@@ -226,15 +309,29 @@ among the command's automatic flags and does not conflict with a selected
226
309
  explicit option or `-h`. Every automatic flag has a long form. Explicit flags
227
310
  and value options keep their definitions.
228
311
 
229
- For a command that delegates to `make_child`, use `add_cmd(..., passthrough: true)`.
312
+ For a command that delegates to `run_child`, use `add_cmd(..., passthrough: true)`.
230
313
  It forwards control without parsing the parent's arguments or intercepting the
231
- child's `--help`. The child declares and parses its own options. Generated help
232
- uses the original command block's source location and declared `args:`, not the
314
+ child's `--help`. The child declares and parses its own options.
315
+ Generated help uses the original command block's source location and declared `args:`, not the
233
316
  internal wrapper's signature.
234
317
 
318
+ `run_child` is the convenience form of `make_child(...).run`. `make_child`
319
+ returns an unrun child when the caller needs to configure it before dispatch.
320
+ Module-level `build_hiiro` methods are builders that return such a child; callers
321
+ run the result. They are not required for an inline child command group.
322
+ Child commands inherit the parent's resolvers, so a task can be bound once and
323
+ shared with nested groups without consuming its name again.
324
+
235
325
  For a CLI that should dispatch only registered blocks, pass
236
- `external_commands: false` to `Hiiro.run` and its `make_child` calls. This
326
+ `external_commands: false` to `Hiiro.run` and its `run_child` or `make_child` calls. This
237
327
  prevents unrelated same-prefix executables on `PATH` from taking precedence.
328
+ Pass `builtin_commands: false` as well to skip the automatic `pry` and `edit`
329
+ commands, for CLIs whose first word is data rather than a command name.
330
+
331
+ Raise `Hiiro::Error` (or a subclass) for expected user-facing failures such as
332
+ bad arguments or missing records. `Hiiro#run` prints `ERROR: message` to stderr
333
+ and exits 1 without a backtrace; any other exception still prints its backtrace.
334
+ `open_default(target)` opens a path or URL with the OS handler (`open` or `xdg-open`).
238
335
 
239
336
  ## Writing Plugins
240
337
 
data/bin/h-bin CHANGED
@@ -3,6 +3,26 @@
3
3
  require 'hiiro'
4
4
 
5
5
  Hiiro.run do
6
+ add_cmd :add, args: ['NAME', 'COMMAND...'] do
7
+ name, *commands = opts.args
8
+ name = name&.delete_prefix('h-')
9
+ abort 'Use a command name containing letters, digits, underscores, or hyphens' unless name&.match?(/\A[A-Za-z0-9][A-Za-z0-9_-]*\z/)
10
+ abort 'Subcommand names cannot be empty' if commands.any?(&:empty?)
11
+
12
+ path = File.join(Dir.home, 'bin', "h-#{name}")
13
+ body = commands.map { |command| " add_cmd #{command.to_sym.inspect} do\n end" }.join("\n\n")
14
+ template = "#!/usr/bin/env ruby\n\nrequire 'hiiro'\n\nHiiro.run do\n"
15
+ template << "#{body}\n" unless body.empty?
16
+ template << "end\n"
17
+
18
+ FileUtils.mkdir_p(File.dirname(path))
19
+ File.open(path, File::WRONLY | File::CREAT | File::EXCL, 0o755) do |file|
20
+ file.write(template)
21
+ file.chmod(0o755)
22
+ end
23
+ puts path
24
+ end
25
+
6
26
  add_subcmd(:list) do |*subcmd_names|
7
27
  patterns = subcmd_names.flatten.compact.map { |sc|
8
28
  sc.sub(/^(?!h-)/, '{h-,}')
data/bin/h-task ADDED
@@ -0,0 +1 @@
1
+ ../exe/t
data/bin/t ADDED
@@ -0,0 +1 @@
1
+ ../exe/t
data/bin/tt ADDED
@@ -0,0 +1 @@
1
+ ../exe/tt