@aymanbagabas/drift 0.0.2 → 0.0.4

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 (2) hide show
  1. package/README.md +265 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,265 @@
1
+ <p align="center">
2
+ <img src="demo/mascot.svg" alt="drift" width="180">
3
+ </p>
4
+
5
+ <h1 align="center">drift</h1>
6
+
7
+ <p align="center">
8
+ <a href="https://crates.io/crates/drift-diff"><img src="https://img.shields.io/crates/v/drift-diff.svg" alt="Crates.io"></a>
9
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT"></a>
10
+ </p>
11
+
12
+ <p align="center">
13
+ A git diff pager that actually wants to be looked at.
14
+ </p>
15
+
16
+ <p align="center">
17
+ <picture>
18
+ <source srcset="https://github.com/aymanbagabas/drift/blob/main/demo/drift.gif?raw=true" type="image/gif">
19
+ <source srcset="https://raw.githubusercontent.com/aymanbagabas/drift/main/demo/drift.gif" type="image/gif">
20
+ <img width="900" alt="drift in action" src="demo/drift.gif">
21
+ </picture>
22
+ </p>
23
+
24
+ `drift` takes the diff you already know and drops it into a real terminal UI:
25
+ syntax highlighting, word-level change emphasis, split or unified views, a
26
+ file-list modal and a live sidebar you can click and drag to resize,
27
+ jump-to-hunk, in-file search, open-in-`$EDITOR`, and a live mode that repaints
28
+ the moment your index or branch moves. Point it at a commit, your staging area,
29
+ or your working tree, or just pipe a diff into it like any other pager.
30
+
31
+ No config needed to start. Themes, colors, and keys are all yours to bend later.
32
+
33
+ ## Install
34
+
35
+ ### Homebrew (macOS, Linux)
36
+
37
+ ```sh
38
+ brew install aymanbagabas/tap/drift
39
+ ```
40
+
41
+ ### Scoop (Windows)
42
+
43
+ ```sh
44
+ scoop bucket add aymanbagabas https://github.com/aymanbagabas/scoop-bucket
45
+ scoop install drift
46
+ ```
47
+
48
+ ### Cargo
49
+
50
+ ```sh
51
+ cargo install drift-diff
52
+ ```
53
+
54
+ ### npm
55
+
56
+ ```sh
57
+ npm install -g @aymanbagabas/drift
58
+ ```
59
+
60
+ ### Debian / Ubuntu
61
+
62
+ ```sh
63
+ echo 'deb [trusted=yes] https://repo.aymanbagabas.com/apt/ /' | sudo tee /etc/apt/sources.list.d/aymanbagabas.list
64
+ sudo apt update && sudo apt install drift
65
+ ```
66
+
67
+ ### Fedora / RHEL
68
+
69
+ ```sh
70
+ echo '[aymanbagabas]
71
+ name=Ayman Bagabas
72
+ baseurl=https://repo.aymanbagabas.com/yum/
73
+ enabled=1
74
+ gpgcheck=0' | sudo tee /etc/yum.repos.d/aymanbagabas.repo
75
+ sudo yum install drift
76
+ ```
77
+
78
+ ### Arch Linux (AUR)
79
+
80
+ ```sh
81
+ yay -S drift-diff-bin
82
+ ```
83
+
84
+ ### Prebuilt binaries
85
+
86
+ Grab an archive for your platform from the
87
+ [latest release](https://github.com/aymanbagabas/drift/releases/latest) and put
88
+ the `drift` binary on your `PATH`.
89
+
90
+ Every method installs a `drift` binary.
91
+
92
+ ## Use it
93
+
94
+ ```sh
95
+ drift # working tree vs HEAD
96
+ drift -A # ...and untracked files too
97
+ drift --staged # what's staged (alias: --cached)
98
+ drift HEAD~3 # a single commit
99
+ drift main..feature # a range
100
+ drift -w # watch the repo and refresh on every change
101
+ git diff | drift # pager mode: read a diff from stdin
102
+ ```
103
+
104
+ > [!TIP]
105
+ > Pair it with an AI agent. Leave `drift -w` open in a split while an agent (Copilot, Claude, etc.) works, every edit lands on screen instantly. Press <kbd>w</kbd> to freeze the view when you want to read, and again to resume.
106
+
107
+ Make it your default git diff pager:
108
+
109
+ ```sh
110
+ git config --global pager.diff drift
111
+ ```
112
+
113
+ Some flags worth knowing:
114
+
115
+ | Flag | What it does |
116
+ |------|--------------|
117
+ | `-w`, `--watch` | Refresh when the git index or refs change |
118
+ | `-A`, `--all` | Also show untracked files (working-tree view only) |
119
+ | `-C`, `--directory DIR` | Run as if started in `DIR` (worktrees, bare repos) |
120
+ | `-c`, `--config FILE` | Use a specific config file |
121
+ | `--no-syntax` | Turn off syntax highlighting for this run |
122
+ | `-U`, `--context N` | Lines of context around each change |
123
+ | `--ignore-whitespace` | Ignore whitespace-only changes |
124
+ | `--diff-algorithm ALGO` | `myers`, `minimal`, `patience`, or `histogram` |
125
+ | `-- PATHSPEC...` | Limit to paths, e.g. `drift -- src/ docs/` |
126
+
127
+ ## Keys
128
+
129
+ | Key | Action |
130
+ |-----|--------|
131
+ | `j` `k` / `↑` `↓` | Move the cursor |
132
+ | `h` `l` / `←` `→` | Scroll horizontally (for lines wider than the view) |
133
+ | `0` `$` | Scroll to line start / end |
134
+ | `d` `u` / `^d` `^u` | Half page down / up |
135
+ | `space` `f` `^f` / `b` `^b` | Full page down / up |
136
+ | `^e` `^y` | Scroll one line down / up |
137
+ | `g` `G` | Top / bottom |
138
+ | `H` `M` `L` | Cursor to screen top / middle / bottom |
139
+ | `{` `}` | Previous / next hunk |
140
+ | `[` `]` / `tab` `⇧tab` | Previous / next file |
141
+ | `/` | Search the current file (regex, smart-case) |
142
+ | `n` `N` | Next / previous match |
143
+ | `s` | Toggle split view |
144
+ | `F` | File list modal |
145
+ | `B` | Toggle the file sidebar |
146
+ | `w` | Toggle watch mode |
147
+ | `V` | Start / cancel a line selection; any motion key extends it |
148
+ | `y` | Copy the selection, or the cursor line when nothing is selected |
149
+ | `Y` | Copy the whole current file |
150
+ | `enter` | Expand folded context, or open the file at the cursor |
151
+ | `v` | Open the current file in `$EDITOR` |
152
+ | `r` | Refresh |
153
+ | `?` | Toggle the help footer |
154
+ | `q` | Quit |
155
+
156
+ ## Mouse
157
+
158
+ drift is fully mouse-driven too:
159
+
160
+ - Click a file in the sidebar to jump straight to it in the diff.
161
+ - Click a file in the file modal to select it; the modal stays open until you
162
+ click outside it (or press `enter`).
163
+ - Drag the sidebar's divider to resize it, live.
164
+ - In split view, drag the divider between the two panes to rebalance them.
165
+ - Click the `? help` badge in the status bar to toggle the help footer.
166
+ - Drag across the diff to select text; it lands on your system clipboard (over
167
+ SSH too, via OSC 52). In split view the selection stays within one pane, so
168
+ you copy just the old or just the new side.
169
+ - Scroll wheel moves the page through the diff (the cursor stays put until it
170
+ reaches an edge). Scroll the wheel left/right to pan wide lines horizontally.
171
+
172
+ ## Themes
173
+
174
+ Set `theme = "..."` in your config. Built in and ready:
175
+
176
+ - `onedark`, `onelight` (the defaults, picked by your terminal background)
177
+ - `dracula`
178
+ - `gruvbox-dark`, `gruvbox-light`
179
+ - `nord`
180
+ - `solarized-dark`, `solarized-light`
181
+ - `catppuccin-mocha`, `catppuccin-latte`
182
+ - `tokyonight`
183
+ - `monokai`
184
+ - `ansi`, which borrows your terminal's own 16 colors so drift matches
185
+ whatever palette you already run. It leaves code text and word-diff
186
+ emphasis alone, since 16 colors are too few to layer cleanly over diff
187
+ colors.
188
+
189
+ Any [syntect](https://github.com/trishume/syntect) theme name works too (for
190
+ example `base16-ocean.dark`), it just won't repaint the UI chrome to match.
191
+
192
+ The `themes/` directory has a full, commented config for every built-in theme.
193
+ Copy one and go:
194
+
195
+ ```sh
196
+ mkdir -p ~/.config/drift
197
+ cp themes/dracula.toml ~/.config/drift/config.toml
198
+ ```
199
+
200
+ ## Config
201
+
202
+ drift looks for a config file, in order, at:
203
+
204
+ - `$XDG_CONFIG_HOME/drift/config.{toml,yaml,yml,json}`
205
+ - `~/.config/drift/config.{toml,yaml,yml,json}`
206
+ - `~/.drift.toml`
207
+
208
+ TOML, YAML, and JSON all work. The top-level knobs:
209
+
210
+ ```toml
211
+ theme = "onedark" # any built-in or syntect theme name
212
+ syntax = true # highlight diff content
213
+ intraline = true # word-level change emphasis
214
+ line-numbers = true # old/new line-number gutter
215
+ tab-width = 4
216
+ editor = "" # falls back to $VISUAL, then $EDITOR, then vi
217
+ sidebar = "auto" # "auto" (opens at width >= 150), "always", or "never"
218
+ sidebar-width = 30 # sidebar columns; drag its divider to resize live
219
+ sidebar-side = "left" # "left" or "right"
220
+ ```
221
+
222
+ Colors come in two layers. `[colors]` is a named palette; `[styles]` maps UI
223
+ components to a `fg bg attrs...` spec resolved against that palette. Every color
224
+ token accepts a palette name, a literal `#rrggbb`, a 0-255 index, an ANSI color
225
+ name, or `default`/`none`/`-` for the terminal's own color. See any file in
226
+ `themes/` for the full set with comments.
227
+
228
+ ### From git config
229
+
230
+ Anything you can set in a config file, you can set in git config under the
231
+ `drift` section, which is handy for per-repo overrides. Colors and styles go in
232
+ `colors` and `styles` subsections. Git forbids `_` in a key, so a field like
233
+ `add_emph` becomes `add-emph`:
234
+
235
+ ```sh
236
+ git config drift.theme nord
237
+ git config drift.line-numbers false
238
+ git config drift.colors.add '#00ff00'
239
+ git config drift.colors.add-emph '#003300'
240
+ git config drift.styles.statusbar 'foreground surface bold'
241
+ ```
242
+
243
+ Or in `~/.gitconfig` directly:
244
+
245
+ ```ini
246
+ [drift]
247
+ theme = nord
248
+ line-numbers = false
249
+ [drift "colors"]
250
+ add = "#00ff00"
251
+ add-emph = "#003300"
252
+ [drift "styles"]
253
+ statusbar = "foreground surface bold"
254
+ ```
255
+
256
+ For the full list of every setting, color, component style, and flag, see
257
+ [CONFIG.md](CONFIG.md).
258
+
259
+ ## Built with
260
+
261
+ drift's terminal UI is powered by [uncurses](https://github.com/aymanbagabas/uncurses), and its multi-channel releases are cut with [GoReleaser](https://goreleaser.com).
262
+
263
+ ## License
264
+
265
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aymanbagabas/drift",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "A standalone git diff pager for the terminal.",
5
5
  "bin": {
6
6
  "drift": "bin/drift.js"