hiiro 0.1.333 → 0.1.334

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: 95465d649a9d286d4b0cb434cf889fe03d225b8ec4227fa108864fdf5130c65a
4
- data.tar.gz: 8104f616921af22bba7de68002157ee22b7cecd20dc6333490403d7769ea7469
3
+ metadata.gz: 1393ef224407fe149858ba4e6ab28d25d9b1ea8234c38295b7248db64f05fc18
4
+ data.tar.gz: 0cb6c207d70bc9b366fe82ad91b0f22d48a3e23d0efd58bb4ce5a9746deb5935
5
5
  SHA512:
6
- metadata.gz: 2785db9671bc137c09d2ec024b2fb807c121f6ff17c3ea19bb649949bdca925f0acf38e9ed3528d49a57ab3d7aabb138afaa454d57abc94fbfba9d49d1ab48d7
7
- data.tar.gz: 452ca83fce6bb36d69e63ff82d3464c8b2dfc6edac54883e8880f666b3e148566a5cfe8f07d2c710f7da988ad882f168d7aea102c5b105ce757c12895789556f
6
+ metadata.gz: e5c17a94ccb9381d940fd594b7c5736433c565c99e78a003b2cf02c6993bf59d727a212e0e98e64ba79812b6b608f9e3472c86702fdb59972fc0d3c5cd9254cb
7
+ data.tar.gz: 1bce72784775186056d106cb55aa253ea9a0ce0fb5fef4b3c9b6800b37e822a7b0ff0be4cabcb5f46b64ae89733b23c3b9ecb7988391c9d8cf8f1e2536ff707c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.334] - 2026-04-07
4
+
5
+ ### Added
6
+ - New `h-ps` bin file for process utilities:
7
+ - `search <pattern>` - find processes matching a substring
8
+ - `indir <path> [path2 ...]` - list processes with files open in specified paths
9
+ - `getdir <pattern>` - list working directories of processes matching pattern
10
+
3
11
  ## [0.1.333] - 2026-04-04
4
12
 
5
13
  ### Changed
data/bin/h-ps ADDED
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "hiiro"
4
+
5
+ Hiiro.run(*ARGV) do
6
+ add_subcmd(:search) { |pattern = nil|
7
+ if pattern.nil?
8
+ puts "Usage: h ps search <pattern>"
9
+ next
10
+ end
11
+
12
+ output = `ps auxww`.lines
13
+ header = output.first
14
+ matches = output[1..].select { |line| line.include?(pattern) }
15
+
16
+ if matches.any?
17
+ puts header
18
+ matches.each { |line| puts line }
19
+ else
20
+ puts "No processes found matching '#{pattern}'"
21
+ end
22
+ }
23
+
24
+ add_subcmd(:indir) { |*paths|
25
+ if paths.empty?
26
+ puts "Usage: h ps indir <path> [path2 ...]"
27
+ next
28
+ end
29
+
30
+ pids = Set.new
31
+ paths.each do |path|
32
+ expanded = File.expand_path(path)
33
+ lsof_output = `lsof +D #{expanded.shellescape} 2>/dev/null`.lines[1..]
34
+ next unless lsof_output
35
+
36
+ lsof_output.each do |line|
37
+ fields = line.split
38
+ pids << fields[1] if fields[1]
39
+ end
40
+ end
41
+
42
+ if pids.empty?
43
+ puts "No processes found with files open in: #{paths.join(', ')}"
44
+ next
45
+ end
46
+
47
+ ps_output = `ps auxww`.lines
48
+ header = ps_output.first
49
+ matches = ps_output[1..].select { |line| pids.include?(line.split[1]) }
50
+
51
+ puts header
52
+ matches.each { |line| puts line }
53
+ }
54
+
55
+ add_subcmd(:getdir) { |pattern = nil|
56
+ if pattern.nil?
57
+ puts "Usage: h ps getdir <pattern>"
58
+ next
59
+ end
60
+
61
+ ps_output = `ps auxww`.lines
62
+ pids = ps_output[1..].select { |line| line.include?(pattern) }.map { |line| line.split[1] }
63
+
64
+ if pids.empty?
65
+ puts "No processes found matching '#{pattern}'"
66
+ next
67
+ end
68
+
69
+ dirs = {}
70
+ pids.each do |pid|
71
+ cwd = `lsof -p #{pid} 2>/dev/null | grep cwd`.strip
72
+ if cwd && !cwd.empty?
73
+ # lsof cwd line format: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
74
+ dir = cwd.split.last
75
+ dirs[pid] = dir
76
+ end
77
+ end
78
+
79
+ if dirs.empty?
80
+ puts "Could not determine working directories for matching processes"
81
+ next
82
+ end
83
+
84
+ dirs.each do |pid, dir|
85
+ process_line = ps_output.find { |l| l.split[1] == pid }
86
+ cmd = process_line.split[10..].join(' ') rescue '(unknown)'
87
+ puts "#{pid}\t#{dir}\t#{cmd}"
88
+ end
89
+ }
90
+ end
data/docs/h-app.md CHANGED
@@ -0,0 +1,189 @@
1
+ # h-app
2
+
3
+ Manage named application subdirectories within a git repo or task worktree. Provides shortcuts to navigate, search, and run tools scoped to each app.
4
+
5
+ ## Synopsis
6
+
7
+ ```bash
8
+ h app <subcommand> [args]
9
+ ```
10
+
11
+ ## Subcommands
12
+
13
+ | Subcommand | Description |
14
+ |------------|-------------|
15
+ | `ls` | List all configured apps |
16
+ | `add <name> <path>` | Register a new app |
17
+ | `rm <name>` | Remove an app |
18
+ | `cd [name]` | Send a `cd` to the current tmux pane |
19
+ | `path [name]` | Print relative path to app (from cwd) |
20
+ | `abspath [name]` | Print absolute path to app |
21
+ | `fd <name> [args]` | Run `fd` scoped to an app directory |
22
+ | `rg <name> [args]` | Run `rg` scoped to an app directory |
23
+ | `vim <name> [args]` | Open vim scoped to an app directory |
24
+ | `sh <name> [cmd]` | Open a shell (or run a command) in an app directory |
25
+ | `config` | Edit `~/.config/hiiro/apps.yml` |
26
+ | `service` | Manage services (delegates to `h service`) |
27
+ | `run` | Run tools against changed files (delegates to `h run`) |
28
+ | `file` | Manage tracked app files (delegates to `h file`) |
29
+
30
+ ### abspath
31
+
32
+ Print the absolute path to the app.
33
+
34
+ **Examples**
35
+
36
+ ```bash
37
+ h app abspath api
38
+ ```
39
+
40
+ ### add
41
+
42
+ Register an app with a name and relative path from the repo root.
43
+
44
+ **Examples**
45
+
46
+ ```bash
47
+ h app add api backend/api
48
+ h app add web frontend/web
49
+ ```
50
+
51
+ ### cd
52
+
53
+ Send a `cd` command to the current tmux pane to navigate to an app directory. Resolves the app path relative to the git repo root or current task tree. With no name, `cd`s to the repo root.
54
+
55
+ **Examples**
56
+
57
+ ```bash
58
+ h app cd
59
+ h app cd api
60
+ ```
61
+
62
+ ### config
63
+
64
+ Edit the apps config file (`~/.config/hiiro/apps.yml`) in your editor.
65
+
66
+ **Examples**
67
+
68
+ ```bash
69
+ h app config
70
+ ```
71
+
72
+ ### fd
73
+
74
+ Run `fd` in the app's directory. All extra arguments are forwarded to `fd`.
75
+
76
+ **Examples**
77
+
78
+ ```bash
79
+ h app fd api '*.rb'
80
+ h app fd web --type f
81
+ ```
82
+
83
+ ### file
84
+
85
+ Delegate to the app file tracking system.
86
+
87
+ **Examples**
88
+
89
+ ```bash
90
+ h app file ls
91
+ h app file add myapp src/main.rb
92
+ ```
93
+
94
+ ### ls
95
+
96
+ List all configured apps with their relative paths.
97
+
98
+ **Examples**
99
+
100
+ ```bash
101
+ h app ls
102
+ ```
103
+
104
+ ### path
105
+
106
+ Print the relative path (from current directory) to the app. With no name, prints the repo root path.
107
+
108
+ **Examples**
109
+
110
+ ```bash
111
+ h app path api
112
+ h app path
113
+ ```
114
+
115
+ ### rg
116
+
117
+ Run `rg` (ripgrep) in the app's directory. All extra arguments are forwarded to `rg`.
118
+
119
+ **Examples**
120
+
121
+ ```bash
122
+ h app rg api 'def foo'
123
+ ```
124
+
125
+ ### rm / remove
126
+
127
+ Remove a registered app.
128
+
129
+ **Examples**
130
+
131
+ ```bash
132
+ h app rm api
133
+ ```
134
+
135
+ ### run
136
+
137
+ Delegate to the runner tool system for running linters/tests against changed files.
138
+
139
+ **Examples**
140
+
141
+ ```bash
142
+ h app run
143
+ h app run lint ruby
144
+ ```
145
+
146
+ ### service
147
+
148
+ Delegate to the `h service` subcommand system, scoped to the current app context. All `h service` subcommands (`ls`, `start`, `stop`, `attach`, `open`, `url`, `port`, `status`, `add`, `rm`, `config`, `groups`, `env`) are available.
149
+
150
+ **Examples**
151
+
152
+ ```bash
153
+ h app service ls
154
+ h app service start my-rails
155
+ ```
156
+
157
+ ### sh
158
+
159
+ Open a shell in the app's directory. If additional arguments are provided, run them as a command instead.
160
+
161
+ **Examples**
162
+
163
+ ```bash
164
+ h app sh api
165
+ h app sh api bundle exec rails console
166
+ ```
167
+
168
+ ### vim
169
+
170
+ Open vim in the app's directory. Extra arguments are forwarded.
171
+
172
+ **Examples**
173
+
174
+ ```bash
175
+ h app vim api
176
+ h app vim api src/main.rb
177
+ ```
178
+
179
+ ## Configuration
180
+
181
+ Apps are stored in `~/.config/hiiro/apps.yml`:
182
+
183
+ ```yaml
184
+ api: backend/api
185
+ web: frontend/web
186
+ workers: backend/workers
187
+ ```
188
+
189
+ Paths are relative to the git repo root (or current task tree path).
data/docs/h-bg.md CHANGED
@@ -0,0 +1,76 @@
1
+ # h-bg
2
+
3
+ Run commands in background tmux windows with command history tracking.
4
+
5
+ ## Synopsis
6
+
7
+ ```bash
8
+ h bg <subcommand> [args]
9
+ ```
10
+
11
+ ## Subcommands
12
+
13
+ | Subcommand | Description |
14
+ |------------|-------------|
15
+ | `run <cmd>` | Run a command in a new background tmux window |
16
+ | `popup` | Open an editor to write and launch a background command |
17
+ | `attach` / `a` | Switch to the background tmux session |
18
+ | `history` / `hist` | Show recent background command history |
19
+ | `setup` | Print tmux.conf snippet for a keybinding |
20
+
21
+ Background commands run in the `hbg` tmux session (created if it doesn't exist). Each command opens in a new window named after the first word of the command. History is stored in `~/.config/hiiro/bg-history.txt` (last 50 commands).
22
+
23
+ ### attach / a
24
+
25
+ Switch the current tmux client to the `hbg` background session.
26
+
27
+ **Examples**
28
+
29
+ ```bash
30
+ h bg attach
31
+ h bg a
32
+ ```
33
+
34
+ ### history / hist
35
+
36
+ Print recent background command history, one per line with index.
37
+
38
+ **Examples**
39
+
40
+ ```bash
41
+ h bg history
42
+ h bg hist
43
+ ```
44
+
45
+ ### popup
46
+
47
+ Open your `$EDITOR` with a template pre-populated from recent history (commented out). Write your command, save, and quit — it runs in the background. Empty or all-comment files are a no-op.
48
+
49
+ **Examples**
50
+
51
+ ```bash
52
+ h bg popup
53
+ ```
54
+
55
+ ### run
56
+
57
+ Run a shell command in a new detached background tmux window. The command is appended to the history file.
58
+
59
+ **Examples**
60
+
61
+ ```bash
62
+ h bg run bundle exec rake test
63
+ h bg run sleep 60
64
+ h bg run ./scripts/long_job.sh
65
+ ```
66
+
67
+ ### setup
68
+
69
+ Print the tmux.conf snippet needed to bind `h bg popup` to a key (prefix + b by default). Add the output to your `~/.tmux.conf`.
70
+
71
+ **Examples**
72
+
73
+ ```bash
74
+ h bg setup >> ~/.tmux.conf
75
+ tmux source-file ~/.tmux.conf
76
+ ```
data/docs/h-bin.md CHANGED
@@ -0,0 +1,39 @@
1
+ # h-bin
2
+
3
+ List and edit hiiro bin scripts (`h-*` executables found in PATH).
4
+
5
+ ## Synopsis
6
+
7
+ ```bash
8
+ h bin <subcommand> [names...]
9
+ ```
10
+
11
+ ## Subcommands
12
+
13
+ | Subcommand | Description |
14
+ |------------|-------------|
15
+ | `list [names]` | List matching bin files |
16
+ | `edit [names]` | Open matching bin files in editor |
17
+
18
+ ### edit
19
+
20
+ Open matching `h-*` bin files in your editor. With no arguments, opens `h-bin` itself.
21
+
22
+ **Examples**
23
+
24
+ ```bash
25
+ h bin edit
26
+ h bin edit branch
27
+ h bin edit pr notify
28
+ ```
29
+ ### list
30
+
31
+ List `h-*` executables found in PATH. With no arguments, lists all. With names, filters to those matching `h-<name>` or `<name>` patterns. Deduplicates by basename (first occurrence wins).
32
+
33
+ **Examples**
34
+
35
+ ```bash
36
+ h bin list
37
+ h bin list branch pr
38
+ ```
39
+