@n-seiji/nuthatch 0.1.0 → 0.1.2

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 (3) hide show
  1. package/README.md +67 -0
  2. package/dist/cli.js +1155 -488
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -33,7 +33,74 @@ hop rm <branch> # remove a worktree (branch is kept)
33
33
  hop clean # auto-detect and remove garbage worktrees
34
34
  hop root <branch> # temporarily switch the root clone (for verification)
35
35
  hop root - # switch the root clone back
36
+
37
+ hop -- <branch> # escape a branch name that collides with a reserved command
38
+ hop --help # print usage (also -h / hop help)
39
+ ```
40
+
41
+ ### Interactive picker
42
+
43
+ The picker groups candidates into sections — existing worktrees (root first)
44
+ and not-yet-created branches — with a status marker, aligned columns, and
45
+ shortened paths:
46
+
36
47
  ```
48
+ WORKTREES
49
+ ❯ ● main root ~/ghq/.../nuthatch
50
+ ○ feat/picker managed …/_worktree/feat__picker
51
+ ● codex/fix-x ext …/.claude/worktrees/x
52
+
53
+ BRANCHES — Enter で worktree 作成
54
+ + feat/idea local
55
+ + origin/hotfix remote
56
+
57
+ (●=dirty ○=clean +=未作成)
58
+ ```
59
+
60
+ A section (header included) disappears entirely when it has no candidates —
61
+ including when a search query filters it down to zero.
62
+
63
+ Ordering within each section is fixed, not insertion order: WORKTREES puts
64
+ root first, then managed worktrees, then external ones (branch name
65
+ ascending within each group, detached-HEAD worktrees last within theirs);
66
+ BRANCHES puts local branches before remote ones (branch name ascending
67
+ within each group). This holds under search filtering too — narrowing the
68
+ list never reshuffles what's left. BRANCHES rows render dim so "already a
69
+ worktree" vs. "not created yet" reads at a glance, on top of the ○/●/+
70
+ markers.
71
+
72
+ The picker runs in the terminal's alternate screen buffer (the same
73
+ mechanism fzf and vim use), so it never gets pushed into your scrollback
74
+ history — each run paints over itself and cleanly restores your shell's
75
+ screen on exit, however it exits (selection, Esc/Ctrl-C, or an interrupt).
76
+
77
+ ### Interactive picker keys
78
+
79
+ The action panel renders as a column beside the candidate list (not an
80
+ overlay), so the list stays visible while you pick an action. On terminals
81
+ narrower than 60 columns it falls back to stacking below the list instead,
82
+ since the two can't fit side by side.
83
+
84
+ | Key | Action |
85
+ |---|---|
86
+ | `Enter` | cd into the selected candidate |
87
+ | `Tab`, `→`, `Ctrl+L`, `Ctrl+F` | Open the action panel for the selected candidate (cd / delete / switch root here) |
88
+ | `Ctrl+X` | Delete the selected worktree (asks y/N first) |
89
+ | `Ctrl+R` | Switch the root clone to the selected branch, immediately |
90
+ | `↑`/`↓`, `Ctrl+P`/`Ctrl+N`, `Ctrl+K`/`Ctrl+J` | Move the selection (arrow, emacs, and vim keys all work side by side) |
91
+ | `Esc` | Cancel quietly — exit 0, stdout stays empty (the shell wrapper just doesn't cd) |
92
+ | `Ctrl+C` | Cancel like an interrupt — exit 130, same as a real SIGINT |
93
+
94
+ Inside the action panel: the same up/down movement keys (left/right are
95
+ reserved for closing, so they never double as movement), `Enter` to run the
96
+ highlighted action, `c`/`d`/`r` to run cd/delete/switch-root directly, and
97
+ `Esc`, `Tab`, `←`, or `Ctrl+H` to close it back to the list (`←`/`Ctrl+H`
98
+ mirror the `→`/`Ctrl+L`/`Ctrl+F` that open it; `Tab` toggles either way —
99
+ handy on terminals like Ghostty that remap a chord such as Cmd+K to Tab). `delete`
100
+ only appears for a worktree nuthatch manages (`managed`); `switch root
101
+ here` doesn't appear on the root worktree itself. Deleting reloads the
102
+ candidate list so you can keep deleting without leaving the picker; cd and
103
+ switch-root exit and print the resulting path, per hop's stdout contract.
37
104
 
38
105
  Shell integration (auto-`cd`):
39
106