hiiro 0.1.366 → 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: 97e9a140ccea0c61c6efe48395bda803e10bec8c0a933a95efb4a949a8788cdf
4
- data.tar.gz: 24c45d70c07d018be4cca31368d91d55b8c8caa89d326e65803c512dcdf3b93e
3
+ metadata.gz: 9f4708a4c90c2b72668cc5f42c6a28ad1b06c5833986e45eb547e8215f6ec64e
4
+ data.tar.gz: e870242d4e60b6dd633a280733456ade72d0cdf999b733e39223cbf46647dd2f
5
5
  SHA512:
6
- metadata.gz: e1b139bc6a4286240311b0106413abed936ebef51771b267d4284ecff70783c5df7a4a0a7b368251e481c8f72ed0cc5d0bc094fe513cffa1563df08123fa65dc
7
- data.tar.gz: 37b32e60d486151dad01c08fdff82db9e9cff23506c8dad72636421b91e77c9e2e7a342b145770d86c615cc982035c4dcc80f3039ec3e457809e431f0bcc5aa2
6
+ metadata.gz: 184881124f6711f940214c20510527d1790c800ea56e3e3b37b74a7060f71aeb564300b12179419cf0ec0099a041df6189ddb41137f132b5c0e0b4f691742572
7
+ data.tar.gz: 1372760dfa76e22fe9305c83c826b72fd2f0e2328b2cd6c0c41f0b1f8baf23720460c150aeb66c434bd666a8779a49f40a7d2338482216dc8edc9bf89a2d1b40
data/CHANGELOG.md CHANGED
@@ -2,6 +2,35 @@
2
2
 
3
3
  ## [Unreleased]
4
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
+
5
34
  ## [0.1.366] - 2026-09-14
6
35
 
7
36
  ### Changed
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,13 +61,15 @@ h ping
61
61
 
62
62
  ### Task CLI
63
63
 
64
- The repository's `bin/t` contains the task commands and helpers, using Hiiro's
65
- `add_cmd` DSL and existing task records. `~/bin/t` and `~/bin/tt` are symlinks to
66
- the repository launchers; installing the gem does not install them. `t NAME new`
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`
67
68
  creates a task and its notes directory without creating a Git worktree.
68
69
 
69
- Use `t TASK COMMAND...`. Bare `t` lists every task, including done and archived
70
- tasks. `t TASK` shows a task. Only exact root `t help` displays generic usage and
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
71
73
  native scoped help without looking up a task. Other first words are task
72
74
  references, even `new`, `show`, `edit`, or `he`.
73
75
 
@@ -112,7 +114,7 @@ without creating a task.
112
114
  Todos share the existing `todos` table with `h todo`. `t` writes only to the
113
115
  database and does not rewrite `todo.yml`. Adding or removing a todo does not
114
116
  change the task's next action, status, or saved selection. Task completion and
115
- archival preserve todos; `h task` behavior is unchanged.
117
+ archival preserve todos. `h task` is a symlink to `t`, so both share one grammar.
116
118
 
117
119
  `t TASK omp`, `t TASK codex` or `cdx`, and `t TASK claude` or `cld` start fresh
118
120
  native CLI sessions in new focused Herdr tabs. Claude always runs `claude`.
@@ -139,18 +141,20 @@ See the [task command reference](docs/t.md) for all commands and the [workflow i
139
141
  | `h setup` | Install plugins and subcommands to system paths |
140
142
  | `h edit` | Open the h script in your editor |
141
143
  | `h alert` | macOS desktop notifications via terminal-notifier |
142
- | `h task` | Task management across git worktrees, including existing external worktrees (via Tasks plugin) |
143
- | `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 |
144
145
 
145
146
  ### External Subcommands
146
147
 
147
148
  | Command | Description |
148
149
  |---------|-------------|
150
+ | `h alias` | Append safely quoted zsh aliases |
149
151
  | `h app` | Manage app directories within tasks/projects |
152
+ | `h bin` | Create, list, and edit Hiiro executables |
150
153
  | `h branch` | Git branch management with fuzzy selection and copy |
151
154
  | `h claude` | Claude CLI wrapper with Herdr split support |
152
155
  | `h commit` | Select commits using fuzzy finder |
153
156
  | `h config` | Open config files (vim, git, Herdr, zsh, starship, claude) |
157
+ | `h env` | Append safely quoted environment variables |
154
158
  | `h link` | Manage saved links with URL, description, and shorthand |
155
159
  | `h pane` | Herdr pane management |
156
160
  | `h plugin` | Manage hiiro plugins (list, edit, search) |
@@ -168,6 +172,33 @@ See the [task command reference](docs/t.md) for all commands and the [workflow i
168
172
 
169
173
  `h claude agents|commands|skills -a` prints the absolute file path for each matching `.claude` tool, including `SKILL.md` for skills.
170
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
+
171
202
  ## Abbreviations
172
203
 
173
204
  Any subcommand can be abbreviated as long as the prefix uniquely matches:
@@ -187,7 +218,7 @@ Plugins are Ruby modules loaded from `~/.config/hiiro/plugins/`:
187
218
  |--------|-------------|
188
219
  | Pins | Per-command YAML key-value storage |
189
220
  | Project | Project directory navigation with Herdr workspace management |
190
- | 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` |
191
222
  | Notify | Herdr desktop notifications |
192
223
 
193
224
  ## Adding Subcommands
@@ -294,6 +325,13 @@ shared with nested groups without consuming its name again.
294
325
  For a CLI that should dispatch only registered blocks, pass
295
326
  `external_commands: false` to `Hiiro.run` and its `run_child` or `make_child` calls. This
296
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`).
297
335
 
298
336
  ## Writing Plugins
299
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
data/docs/h-bin.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # h-bin
2
2
 
3
- List and edit hiiro bin scripts (`h-*` executables found in PATH).
3
+ Create, list, and edit Hiiro bin scripts.
4
4
 
5
- `h bin` uses `Hiiro::Bins` to scan the current `PATH` for executable files.
5
+ `h bin add` creates executables in `~/bin`. The `list` and `edit` commands use `Hiiro::Bins` to scan the current `PATH`.
6
6
 
7
7
  ## Synopsis
8
8
 
@@ -14,9 +14,56 @@ h bin <subcommand> [names...]
14
14
 
15
15
  | Subcommand | Description |
16
16
  |------------|-------------|
17
+ | `add NAME [COMMAND ...]` | Create an executable template without overwriting an existing file |
17
18
  | `list [names]` | List matching bin files |
18
19
  | `edit [names]` | Open matching bin files in editor |
19
20
 
21
+ ### add
22
+
23
+ Create `~/bin/h-NAME`. An optional `h-` prefix is accepted. Executable names must
24
+ start with a letter or digit and contain only letters, digits, underscores, or
25
+ hyphens.
26
+
27
+ ```sh
28
+ h bin add scratch
29
+ ```
30
+
31
+ With no command arguments, the generated file contains:
32
+
33
+ ```ruby
34
+ #!/usr/bin/env ruby
35
+
36
+ require 'hiiro'
37
+
38
+ Hiiro.run do
39
+ end
40
+ ```
41
+
42
+ To include empty command blocks:
43
+
44
+ ```sh
45
+ h bin add josh list show
46
+ ```
47
+
48
+ ```ruby
49
+ #!/usr/bin/env ruby
50
+
51
+ require 'hiiro'
52
+
53
+ Hiiro.run do
54
+ add_cmd :list do
55
+ end
56
+
57
+ add_cmd :show do
58
+ end
59
+ end
60
+ ```
61
+
62
+ Command names are serialized as Ruby symbols, including quoted symbols for
63
+ names such as `hello-world`. Generated files are executable. Existing files
64
+ and symlinks are refused, and no editor or generated command is launched.
65
+ Native Hiiro options handle `--help` and the `--` end-of-options marker.
66
+
20
67
  ### edit
21
68
 
22
69
  Open matching `h-*` bin files in your editor. With no arguments, opens `h-bin` itself.
data/docs/h-subtask.md CHANGED
@@ -1,50 +1,11 @@
1
1
  # h subtask
2
2
 
3
- Manage subtasks within the current parent task. Subtasks follow the same worktree + Herdr workspace model as top-level tasks, but are scoped under the current task (for example, `my-feature/auth`).
4
-
5
- All subcommands are identical to [h task](h-task.md) but operate on the subtask scope. Subtask names are relative (e.g. `auth` rather than `my-feature/auth`).
6
-
7
- ## Synopsis
3
+ `h subtask` was removed when `h task` became a symlink to `t`. A subtask is a task whose name is `parent/child`:
8
4
 
9
5
  ```bash
10
- h subtask <subcommand> [args]
6
+ t my-feature/auth tree new # worktree at ~/work/my-feature/auth, workspace "my-feature/auth"
7
+ t my-feature/auth todo add Wire the login form
8
+ t my-feature/auth tree rm
11
9
  ```
12
10
 
13
- ## Scope behavior
14
-
15
- When in a task workspace, `h subtask` lists and operates on subtasks of the current parent task. A synthetic `main` subtask is always shown, representing the parent task's primary worktree.
16
-
17
- Subtask names are stored as `parent/child` (e.g. `my-feature/auth`) but displayed as their short name (`auth`) in subtask context.
18
-
19
- ## Subcommands
20
-
21
- All subcommands from [h task](h-task.md) are available. Key ones:
22
-
23
- | Subcommand | Description |
24
- |------------|-------------|
25
- | `ls` / `list` | List subtasks of the current task |
26
- | `start <name>` | Create or switch to a subtask |
27
- | `switch [name]` | Switch to a subtask workspace |
28
- | `stop [name]` | Stop a subtask (preserves worktree) |
29
- | `current` | Print the current subtask name |
30
- | `status` / `st` | Show current subtask details |
31
- | `branch [name]` | Print branch for a subtask |
32
- | `tree [name]` | Print worktree name for a subtask |
33
- | `session [name]` | Print session name for a subtask |
34
- | `cd [name] [app]` | Send `cd` to current pane |
35
- | `path [name] [app]` | Print path to subtask directory |
36
- | `todo [args]` | Manage todos for current subtask |
37
- | `queue [args]` | Claude queue scoped to current subtask |
38
-
39
- ## Examples
40
-
41
- ```bash
42
- h subtask ls
43
- h subtask start auth
44
- h subtask switch
45
- h subtask switch auth
46
- h subtask current
47
- h subtask status
48
- h subtask cd auth
49
- h subtask stop auth
50
- ```
11
+ See [t](t.md) and [h task](h-task.md).