@n-seiji/nuthatch 0.1.3 → 0.1.5

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.
Files changed (4) hide show
  1. package/README.ja.md +47 -6
  2. package/README.md +47 -9
  3. package/dist/cli.js +1601 -530
  4. package/package.json +2 -2
package/README.ja.md CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  ```sh
26
26
  hop # worktree/branch を対話的に選んで cd
27
- hop feat/foo # feat/foo の worktree へ cd — 未作成ならその場で作成
27
+ hop feat/foo # feat/foo の worktree へ cd (未作成なら --create でその場で作成)
28
28
  hop root # root clone へ cd
29
29
  hop - # 直前の worktree へ戻る
30
30
 
@@ -38,6 +38,10 @@ hop root - # root clone を元に戻す (root の branch のみ; swap
38
38
  hop -- <branch> # 予約コマンドと被る branch 名をエスケープ
39
39
  # (`hop` 自体と同名の branch (例: `hop -- hop`) にも必要)
40
40
  hop --help # usage を表示 (-h / hop help でも同じ)
41
+
42
+ hop --version # hop の version を表示
43
+ hop --update # 最新リリースへ、インストールした方法のまま更新
44
+ hop --update --check # --update が何をするかを報告するだけ — 何も変更しない
41
45
  ```
42
46
 
43
47
  同じ branch が複数の worktree で checkout されている場合、branch だけを指定する
@@ -79,14 +83,14 @@ picker は terminal の alternate screen buffer (fzf や vim と同じ仕組み)
79
83
  ### 対話的 picker のキー
80
84
 
81
85
  action panel は候補一覧の隣に列として表示される (overlay ではない) ので、
82
- action を選ぶ間も一覧が見え続ける。60 列未満の terminal では横に並べられ
83
- ないため、一覧の下にスタックする形にフォールバックする。
86
+ action を選ぶ間も一覧が見え続ける。横に並べられない幅 (おおよそ 94 列
87
+ 未満) の terminal では、一覧の下にスタックする形にフォールバックする。
84
88
 
85
89
  | キー | 動作 |
86
90
  |---|---|
87
91
  | `Enter` | 選択中の候補へ cd |
88
92
  | `Tab`, `→`, `Ctrl+L`, `Ctrl+F` | 選択中の候補の action panel を開く (ここで cd / 削除 / root 切替) |
89
- | `Ctrl+X` | 選択中の worktree を削除 (`external` は先に y/N を確認) |
93
+ | `Ctrl+X` | 選択中の worktree を削除 (常に先に y/N を確認) |
90
94
  | `Ctrl+R` | root clone を選択中の branch へ切替 (`external` は先に y/N を確認) |
91
95
  | `↑`/`↓`, `Ctrl+P`/`Ctrl+N`, `Ctrl+K`/`Ctrl+J` | 選択を移動 (矢印・emacs・vim キーがすべて併用可) |
92
96
  | `Esc` | 静かにキャンセル — exit 0、stdout は空のまま (shell wrapper は cd しない) |
@@ -99,8 +103,9 @@ action panel 内: 同じ上下移動キー (左右は閉じる操作に予約さ
99
103
  対になっている; `Tab` はどちらの状態からでもトグルする — Ghostty のように
100
104
  Cmd+K のようなキーの組み合わせを Tab に remap する terminal で便利)。
101
105
  `delete` はすでに作成済みの worktree (`managed` / `external`) すべてに
102
- 表示される (`external` の削除は panel からでも Ctrl+X からでも必ず y/N
103
- を確認する); `switch root here` は root worktree 自身には表示されず、
106
+ 表示される (panel からの削除は、`external` worktree と、git が作業ツリーを
107
+ 見失った prunable な worktree なら先に y/N を確認する。Ctrl+X は常に
108
+ 確認する); `switch root here` は root worktree 自身には表示されず、
104
109
  `external` worktree に対しては HEAD を detach する可能性があるため
105
110
  同じく先に y/N を確認する。削除すると候補一覧が再読み込みされ、picker を
106
111
  抜けずに削除を続けられる; cd と switch-root は終了して結果の path を
@@ -137,6 +142,42 @@ install script は `hop` を `~/.local/bin` に置き (`HOP_INSTALL_DIR` で
137
142
  には `HOP_VERSION=vX.Y.Z` を使う。Linux arm64 はビルド済みバイナリが
138
143
  まだないため、npm install を使う。
139
144
 
145
+ ### 更新
146
+
147
+ ```sh
148
+ hop --update # 最新リリースへ、インストールした方法のまま更新
149
+ hop --update --check # 報告だけ: current / latest / method / 実行されるコマンド
150
+ hop --version # 今どの version か
151
+ ```
152
+
153
+ `hop --update` は hop のインストール方法を判定する。`install.sh` で入れた
154
+ バイナリは、置き場のディレクトリに書き込めて (バイナリと checksum の
155
+ ダウンロードの前に確認する)、かつリリースに添付された `.sha256` と SHA-256 が
156
+ 一致した場合にだけその場で差し替える — 不一致なら何も置換しない。
157
+ mise / npm / bun 経由の install は、そのツール自身の upgrade コマンド
158
+ (`mise upgrade …`、
159
+ `npm install -g --prefix <hop が入っている prefix> @n-seiji/nuthatch@latest`、
160
+ `bun add -g @n-seiji/nuthatch@latest`) をホームディレクトリで実行して更新する
161
+ ので、グローバルの mise 設定で固定した version が優先され (hop は先に mise へ
162
+ 問い合わせ、upgrade するものが無ければ警告する)、プロジェクトの `mise.toml`
163
+ には左右されず、npm の更新は hop が今入っている prefix に入る。`npx` / `bunx`、
164
+ ソースチェックアウト、Homebrew・Nix・aqua・proto など他のバージョン管理ツール
165
+ が自分用にコピーを持っているバイナリ、hop が扱わない配置 (pnpm・yarn の
166
+ global、プロジェクトの依存) は、代わりにどうすればよいかを示して拒否する。
167
+ hop がネットワークに出るのはこれだけで、GitHub と npm の固定アドレスへの
168
+ HTTPS リクエストのみ (タイムアウトとサイズ上限つき)。
169
+
170
+ ## トラブルシューティング
171
+
172
+ `hop: git executable not found. Looked in: …` は git のバイナリを見つけられ
173
+ なかったという意味。hop は `PATH` の絶対パスエントリを順に探し、その後
174
+ `/opt/homebrew/bin`, `/usr/local/bin`, `/usr/bin`, `/bin` を見る。git が
175
+ それ以外の場所にある場合は、直接指定する:
176
+
177
+ ```sh
178
+ export HOP_GIT=/path/to/git
179
+ ```
180
+
140
181
  ## Agent skill (Claude Code / Codex plugin)
141
182
 
142
183
  このリポジトリは plugin marketplace も兼ねており、
package/README.md CHANGED
@@ -26,7 +26,7 @@ doesn't exist yet. Built for humans (interactive picker) and AI coding agents
26
26
 
27
27
  ```sh
28
28
  hop # pick a worktree/branch interactively and cd into it
29
- hop feat/foo # cd into feat/foo's worktree — created on demand
29
+ hop feat/foo # cd into feat/foo's worktree (add --create to create it if missing)
30
30
  hop root # cd into the root clone
31
31
  hop - # cd back to the previous worktree
32
32
 
@@ -40,6 +40,10 @@ hop root - # switch the root clone back (only root's branch; a swapped-o
40
40
  hop -- <branch> # escape a branch name that collides with a reserved command
41
41
  # (also required for a branch named the same as your `hop` binary/alias, e.g. `hop -- hop`)
42
42
  hop --help # print usage (also -h / hop help)
43
+
44
+ hop --version # print hop's version
45
+ hop --update # update hop to the latest release, the way it was installed
46
+ hop --update --check # only report what --update would do — changes nothing
43
47
  ```
44
48
 
45
49
  If Git reports the same branch checked out in multiple worktrees, the
@@ -87,14 +91,14 @@ screen on exit, however it exits (selection, Esc/Ctrl-C, or an interrupt).
87
91
 
88
92
  The action panel renders as a column beside the candidate list (not an
89
93
  overlay), so the list stays visible while you pick an action. On terminals
90
- narrower than 60 columns it falls back to stacking below the list instead,
91
- since the two can't fit side by side.
94
+ too narrow to fit both (under about 94 columns) it falls back to stacking
95
+ below the list instead.
92
96
 
93
97
  | Key | Action |
94
98
  |---|---|
95
99
  | `Enter` | cd into the selected candidate |
96
100
  | `Tab`, `→`, `Ctrl+L`, `Ctrl+F` | Open the action panel for the selected candidate (cd / delete / switch root here) |
97
- | `Ctrl+X` | Delete the selected worktree (asks y/N first for an `external` worktree) |
101
+ | `Ctrl+X` | Delete the selected worktree (always asks y/N first) |
98
102
  | `Ctrl+R` | Switch the root clone to the selected branch (asks y/N first for an `external` worktree) |
99
103
  | `↑`/`↓`, `Ctrl+P`/`Ctrl+N`, `Ctrl+K`/`Ctrl+J` | Move the selection (arrow, emacs, and vim keys all work side by side) |
100
104
  | `Esc` | Cancel quietly — exit 0, stdout stays empty (the shell wrapper just doesn't cd) |
@@ -106,8 +110,9 @@ highlighted action, `c`/`d`/`r` to run cd/delete/switch-root directly, and
106
110
  `Esc`, `Tab`, `←`, or `Ctrl+H` to close it back to the list (`←`/`Ctrl+H`
107
111
  mirror the `→`/`Ctrl+L`/`Ctrl+F` that open it; `Tab` toggles either way —
108
112
  handy on terminals like Ghostty that remap a chord such as Cmd+K to Tab). `delete`
109
- appears for any already-created worktree (`managed` or `external` — deleting
110
- an `external` one always asks y/N, whether from the panel or Ctrl+X); `switch
113
+ appears for any already-created worktree (`managed` or `external` — from the
114
+ panel, deleting an `external` worktree, or a prunable one (git can no longer
115
+ find its working tree), asks y/N first; Ctrl+X always asks); `switch
111
116
  root here` doesn't appear on the root worktree itself, and also asks y/N
112
117
  first for an `external` worktree, since it can detach that worktree's HEAD.
113
118
  Deleting reloads the
@@ -123,9 +128,6 @@ eval "$(hop init zsh)"
123
128
 
124
129
  ## Install
125
130
 
126
- > Not released yet — no version has been published or tagged. Once the first
127
- > `v*` tag ships, the options below will work as described.
128
-
129
131
  Recommended: the GitHub Release binary (built with bun; via mise,
130
132
  `mise use github:n-seiji/nuthatch`). The npm version runs on Node, so its git
131
133
  calls are slower (hop ls ~400ms vs ~60ms) — prefer the binary for CI or
@@ -146,6 +148,42 @@ The install script places `hop` in `~/.local/bin` (override with
146
148
  specific version with `HOP_VERSION=vX.Y.Z`. Linux arm64 has no prebuilt
147
149
  binary yet — use the npm install instead.
148
150
 
151
+ ### Updating
152
+
153
+ ```sh
154
+ hop --update # update to the latest release, the way hop was installed
155
+ hop --update --check # just report: current, latest, method, and the command it would run
156
+ hop --version # which version do I have?
157
+ ```
158
+
159
+ `hop --update` detects how hop was installed. A binary from `install.sh` is
160
+ replaced in place, but only if its directory is writable (checked before the
161
+ binary or its checksum is downloaded) and only after its SHA-256 matches the
162
+ `.sha256` attached to the release — on a mismatch nothing is replaced. A mise /
163
+ npm / bun install is updated by running that tool's own upgrade command from
164
+ your home directory (`mise upgrade …`,
165
+ `npm install -g --prefix <the prefix hop lives in> @n-seiji/nuthatch@latest`,
166
+ `bun add -g @n-seiji/nuthatch@latest`), so a version pinned in your global mise
167
+ config still wins (hop asks mise first and warns when it has nothing to
168
+ upgrade), a project's own `mise.toml` cannot interfere, and an npm update lands
169
+ in the prefix hop is already in. `npx` / `bunx`, a source checkout, a binary
170
+ that Homebrew, Nix, aqua, proto or another version manager keeps its own copy
171
+ of, and layouts hop does not drive (a pnpm or yarn global, a project
172
+ dependency) are refused with a note on what to do instead. This is the only
173
+ thing hop does over the network: HTTPS requests to fixed GitHub and npm
174
+ addresses, each with a timeout and a size cap.
175
+
176
+ ## Troubleshooting
177
+
178
+ `hop: git executable not found. Looked in: …` means hop could not find a git
179
+ binary. hop searches every absolute entry in `PATH`, then `/opt/homebrew/bin`,
180
+ `/usr/local/bin`, `/usr/bin` and `/bin`. If your git lives somewhere else,
181
+ point hop straight at it:
182
+
183
+ ```sh
184
+ export HOP_GIT=/path/to/git
185
+ ```
186
+
149
187
  ## Agent skill (Claude Code / Codex plugin)
150
188
 
151
189
  This repo doubles as a plugin marketplace that ships the