diffstalkerd 0.7.1 → 0.8.0

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,409 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.8.0] - 2026-07-26
11
+
12
+ A security-hardening and web-UI-polish release. The daemon is now
13
+ loopback-only with an origin guard and a least-privilege API surface, the
14
+ repo gained public-project governance, and the web UI got a round of polish.
15
+
16
+ ### Security
17
+
18
+ - **The daemon binds loopback only.** Removed the `--host` flag — there is no
19
+ option to bind a routable interface (it has no authentication). Reach it from
20
+ another machine over an SSH tunnel (`ssh -L 7337:localhost:7337 …`).
21
+ - **Origin guard on a bound `--port`.** A `Host` allow-list blocks DNS-rebinding
22
+ (421) and cross-site requests are rejected (CSRF, 403); non-browser clients
23
+ (the CLI, `curl`) pass untouched. Every response also carries hardening headers
24
+ (`X-Content-Type-Options`, `X-Frame-Options: DENY`, `Referrer-Policy`) and a
25
+ strict `Content-Security-Policy` for the served SPA.
26
+ - **Least-privilege REST surface on a port.** A `--port` (web) daemon routes only
27
+ what the web UI uses — reads, repo open/release, and file-level stage/unstage.
28
+ Every CLI-only mutation (commit, discard, hunk staging, remote/branch
29
+ operations, persisted compare base) returns `404`; the full API stays on the
30
+ CLI's unix socket.
31
+ - Hardened the untracked-file diff (realpath containment against symlink escapes
32
+ + a read cap) and bounded the history `count` parameter.
33
+
34
+ ### Added
35
+
36
+ - Public-project governance: `SECURITY.md`, `CONTRIBUTING.md`, `CODEOWNERS`,
37
+ Dependabot, CodeQL, and continuous CI (build + lint + full test suite on every
38
+ push and pull request).
39
+ - A workspace-wide circular-dependency check that catches cross-package cycles
40
+ the per-package checks miss.
41
+
42
+ ### Changed
43
+
44
+ - **Web UI polish.** Per-view toolbars now get their own row instead of crowding
45
+ the global toggles; Compare shows the `branch → base` direction and reload
46
+ feedback; stacked diffs pin the hunk header below the file header; the Journal
47
+ entry header was redesigned to match the rest of the site — a `--surface`
48
+ strip with a kind-coloured left rail, the kind shown as colour-coded text
49
+ (the site's status idiom) and a bold filename — dropping the bordered kind
50
+ pill and the line range that just duplicated the diff's own @@ header.
51
+ - Journal: a commit (or any boundary that retired changes) can now be folded
52
+ to collapse the entries it committed into its one line, click to re-expand.
53
+ And "created" now reads as "new file" only for a genuinely new file — a new
54
+ change region in an existing file reads as "edited" (coloured modified),
55
+ which is what it actually is.
56
+ - Journal, restraint pass: pared back to a calm second-screen viewer of your
57
+ uncommitted work. Dropped the outdated-stub resurrection, the "seeded" tag,
58
+ the kind-help hover glossary, per-entry copy-path, and the fold-chain
59
+ drill-in (the ×N is now a static churn marker); `expanded`/`shrunk` fold into
60
+ `edited` and `renamed` renders neutral, so the kind vocabulary is just
61
+ new-file / edited / reverted; relative times freeze to a wall-clock HH:MM
62
+ past an hour so the column stops perpetually re-ticking. Fixed selection-vs-hover across every list (a selected row was
63
+ indistinguishable from a hovered one), added focus-visible rings, and gave the
64
+ stage/unstage buttons semantic hover colors.
65
+ - README leads with the web UI, with light and dark screenshots.
66
+
67
+ ### Internal
68
+
69
+ - Dependency refresh: eslint 10, TypeScript 6.0, chokidar 5, and the GitHub
70
+ Actions majors. `engines.node` raised to `>=20.19.0` (chokidar 5's floor).
71
+
72
+ ## [0.7.1] - 2026-07-23
73
+
74
+ ### Changed
75
+
76
+ - **Compare view — the active-file indicator follows your scroll.** As you scroll
77
+ the stacked diffs, the file list highlights whichever file you are on (and
78
+ nearest-edge-scrolls to keep that row in view), through the SAME mechanism a
79
+ click uses. That focus indicator is now prominent — a selection-tinted row,
80
+ clearly distinct from the hover state — in both the Compare and Changes views,
81
+ and the first file is selected on load so the indicator is present from the
82
+ start.
83
+
84
+ ## [0.7.0] - 2026-07-23
85
+
86
+ ### Added
87
+
88
+ - **Journal view (web UI).** A new second view — a chronological, downward-only
89
+ log of every change as it happens, tracked **per hunk** rather than per file:
90
+ two edits to two different files land as two entries at the bottom even if
91
+ those files also changed higher up. Each entry has a timestamp, path, kind
92
+ (created / edited / expanded / shrunk / reverted / renamed), line span, +/−
93
+ stats, and its own diff. When a hunk is edited/expanded/shrunk/reverted the
94
+ older entry higher up is marked outdated and collapses while the fresh one
95
+ appears at the bottom (lineage via a `supersedes` chain); rapid edits to one
96
+ hunk fold into a single entry. The log is daemon-owned (HEAD-axis observation,
97
+ in-memory, bounded/pruned), streamed over SSE with an epoch + `since`
98
+ reconnect protocol so a client never sees a torn or interleaved log. Huge and
99
+ binary files show a collapsed placeholder. Observation is guarded against
100
+ torn reads during external `git checkout`/rebase so those never storm the log.
101
+ - **Diff viewing modes (web UI).** Two global, persisted header toggles applied
102
+ to every diff surface (Changes, Journal, History, Compare) through the one
103
+ shared diff renderer: **syntax highlighting** (highlight.js-tokenized content
104
+ vs. plain text — language detected per file, theme-colored so it stays readable
105
+ over the add/del row tints, composing with the existing word-level
106
+ highlighting) and a **split / side-by-side view** (old on the left, new on the
107
+ right; deletions paired with additions row-for-row, long lines scrolling
108
+ horizontally).
109
+ - **File staging in the web UI.** The Changes view gains a per-row stage (+) /
110
+ unstage (−) button — the web UI's first working-tree mutation. No commit,
111
+ discard, or hunk-staging; those stay in the terminal UI.
112
+ - **Stacked diff surface (web UI).** Changes and Compare render every file's diff
113
+ in one continuous scroll with sticky per-file headers and per-file collapse;
114
+ the file list becomes a jump navigator into the stack.
115
+ - **Broader syntax-highlighting coverage.** The Explorer file viewer and the diff
116
+ syntax mode now cover many more file types — Vue SFCs, Jenkinsfiles (Groovy),
117
+ Dockerfiles, PowerShell, HCL/Terraform, F#, Elixir, Clojure, and others —
118
+ instead of falling back to plain text.
119
+
120
+ ### Changed
121
+
122
+ - **Responsive web layout.** The header reflows on narrow / portrait screens —
123
+ the repo identity and the find-file + theme controls stay put while the mode
124
+ toggles drop to their own full-width row — and at 1080px wide or less the
125
+ activity rail becomes a top tab band and every side-by-side view (list | diff)
126
+ stacks top-over-bottom, so nothing overflows on a vertical monitor. The app no
127
+ longer stretches past the viewport on a wide diff line.
128
+ - **Journal polish.** Entries live-tick their relative time from the moment they
129
+ arrive, keep the file name visible on long paths (the directory ellipses, full
130
+ path on hover), and gain a copy-full-path button; the kind badge and the
131
+ "changed before the Journal started" (seeded) note explain themselves on hover.
132
+ - The draggable divider between the two panes in every split view is now a
133
+ visible bar with a grab handle, so the file list and the diff / content read as
134
+ clearly separate. Ellipsized paths and labels throughout the UI gained hover
135
+ titles so the full text is always reachable.
136
+
137
+ ## [0.6.0] - 2026-07-21
138
+
139
+ ### Added
140
+
141
+ - **Web UI (read-only viewer).** `diffstalkerd` now serves a Vue 3 browser client
142
+ at `GET /` (run it with `--port N`, open `http://localhost:N`). It is a viewer,
143
+ not a manager — it reads git state and never mutates it. Four views mirroring the
144
+ terminal UI: Changes (file list + working-tree diffs, per-hunk view), History
145
+ (commit list + diff), a GitHub-PR-style Compare view against a base branch, and
146
+ an Explorer with syntax highlighting. Plus a fuzzy file finder, the six themes,
147
+ and live updates over SSE. The web build ships inside the `diffstalkerd` tarball
148
+ — it is not a separately published package. No authentication; the daemon binds
149
+ `127.0.0.1` — keep it on localhost.
150
+ - **Follow + auto mode in the web UI.** A follow toggle switches the viewed repo
151
+ when an external tool appends to the follow hook file. Auto mode additionally
152
+ selects the freshest-changed file (and flashes it) and switches views as the
153
+ changed-file set grows or empties — driven by a new per-file mtime signal the
154
+ daemon now includes in shared state (browsers can't `fs.stat`, and it also
155
+ defeats SSE payload dedup so in-place edits still fire an update).
156
+ - **Portrait / vertical-monitor layout.** On portrait or square viewports the
157
+ view rail rotates into a full-width top tab band and each view stacks its list
158
+ above a full-width diff, with drag-resizable rows. Landscape is byte-for-byte
159
+ unchanged.
160
+ - **Collapsible folders** in the web Compare and Explorer file trees, with
161
+ single-child directory chains folded onto one row for compactness.
162
+ - A favicon (the diff-gutter add/remove mark) for the web UI.
163
+
164
+ ### Internal
165
+
166
+ - **Single-source versioning.** The root `package.json` is now the one source of
167
+ version truth. `scripts/release.sh` reads and bumps it, and derives the two
168
+ published manifests (`diffstalker`, `diffstalkerd`) from it in lockstep. The
169
+ private, bundled packages (`@diffstalker/core`, `@diffstalker/client`,
170
+ `@diffstalker/web`) are pinned to a static `0.0.0` and never versioned — they
171
+ ship inside the published bundles, never on their own. The release's bun.lock
172
+ patch is now equality-scoped to the outgoing version and asserts the published
173
+ entries landed on the new one, so it can't silently ship a stale pin.
174
+ - A shared `@diffstalker/core/view/*` presentation-logic layer (diff/word/tree/
175
+ format helpers) extracted from the CLI and reused by the web client.
176
+
177
+ ## [0.5.1] - 2026-07-20
178
+
179
+ ### Fixed
180
+
181
+ - The published `diffstalker` now pins the exact matching `diffstalkerd`
182
+ version. `release.sh` refreshes `bun.lock`'s workspace versions on bump
183
+ (`bun pm pack` derives the cli's `diffstalkerd` pin from the lockfile, not
184
+ the manifest), and CI now fails the release if any published package's
185
+ workspace-sibling pin is not the exact release version. 0.5.0 shipped
186
+ pinning `diffstalkerd@0.4.0` — functional (same daemon build) but wrong.
187
+
188
+ ## [0.5.0] - 2026-07-20
189
+
190
+ ### Changed
191
+
192
+ - **Daemon architecture.** The single npm package was split into a bun
193
+ monorepo of four packages: `@diffstalker/core` (headless git state),
194
+ `@diffstalker/daemon` (`diffstalkerd`: a Node http REST + SSE server over
195
+ core), `@diffstalker/client` (a typed REST + SSE client), and `diffstalker`
196
+ (the terminal UI). Same features, new plumbing.
197
+ - **The CLI is now a daemon-backed client.** It holds no in-process git: on
198
+ launch it attaches to a running `diffstalkerd` or spawns one on a unix
199
+ socket, opens repos over REST, and follows live state over SSE. A new
200
+ `RepoSession` is the client-side store (shared state over SSE + mutation
201
+ envelopes; selection/history/compare pulled on demand).
202
+ - **The daemon owns git state and follow mode.** It watches the follow hook
203
+ file and broadcasts `follow-change` so any client can switch focus; the CLI
204
+ reacts to it as policy. The in-process command server and follow-file
205
+ watcher were removed from the CLI.
206
+ - Opening or following a bare-repo container no longer forces a worktree
207
+ choice through the picker; the most recently active worktree (by git
208
+ index/HEAD activity) is opened automatically. Shift+W still switches
209
+ worktrees explicitly.
210
+ - **A leaner `diffstalker`.** The published UI no longer depends on a git
211
+ library: the pure diff/patch parsers it needs (hunk extraction, status
212
+ maps) were split into dependency-free core modules, so `simple-git` is now
213
+ a `diffstalkerd`-only dependency. The two published packages are the lean
214
+ `diffstalker` (which pulls in `diffstalkerd`) and `diffstalkerd` itself.
215
+
216
+ ### Added
217
+
218
+ - **`diffstalkerd` binary** (`@diffstalker/daemon`): REST + SSE over
219
+ `@diffstalker/core`, unix-socket by default (`0600` under
220
+ `$XDG_RUNTIME_DIR`), with follow mode and systemd socket activation. See
221
+ `packages/daemon/README.md`.
222
+ - **Graceful daemon reconnect.** When the SSE stream drops, the CLI shows one
223
+ calm "daemon connection lost — reconnecting…" line and recovers in the
224
+ background — re-spawning the daemon if needed and re-opening repos by their
225
+ stable path-hashed id (no ENOENT screen spam).
226
+ - `scripts/rmrf.sh` helper for safe recursive deletes.
227
+
228
+ ### Removed
229
+
230
+ - The `--once` flag (show status once and exit). The UI is always a live,
231
+ daemon-backed view now.
232
+ - The in-process command server and follow-file watcher, which moved into
233
+ `diffstalkerd`.
234
+
235
+ ## [0.4.0] - 2026-07-07
236
+
237
+ ### Fixed
238
+
239
+ - **npm package was uninstallable**: the postinstall hook pointed at a script
240
+ excluded from the published tarball, so every `npm install diffstalker`
241
+ failed. The neo-blessed 24-bit RGB patch is now applied at runtime, with no
242
+ postinstall step.
243
+ - Commit submission: pressing Enter in the commit input never actually
244
+ submitted (it appended an invisible newline); the commit is now submitted
245
+ with Ctrl+S.
246
+ - Transient git failures (e.g. index.lock contention) no longer wipe the file
247
+ list by masquerading as "not a git repository".
248
+ - Watcher and IPC socket errors no longer crash the app; errors surface in
249
+ the header instead of disappearing.
250
+ - Crash diagnostics are printed to the normal screen buffer instead of being
251
+ discarded with the alternate one.
252
+ - Untracked file names containing shell metacharacters no longer break the
253
+ diff preview.
254
+
255
+ ### Added
256
+
257
+ - Per-hunk edit times in the diff viewer ("just now", "5 minutes ago",
258
+ "2 days ago"), observed live while diffstalker runs, with file mtime as
259
+ the fallback for pre-session changes. Freshly-changed hunks flash yellow,
260
+ and in auto mode the diff pane scrolls to keep the newest change on
261
+ screen. Sub-minute times update every second.
262
+ - Multi-line commit messages: the commit input is now 4 rows; Enter inserts
263
+ a newline, Ctrl+S commits.
264
+ - Page scrolling (PageUp/PageDown, Ctrl+U/Ctrl+D) and jump to top/bottom
265
+ (g/G) in lists and diff panes.
266
+ - `d` on an untracked file now offers to delete it (git clean) with
267
+ confirmation.
268
+ - Tests for the hunk staging pipeline and WorkingTreeManager.
269
+
270
+ ### Changed
271
+
272
+ - Published package ships via a files allowlist; requires node >= 20.
273
+ - Releases publish to npm before pushing the metrics commit, and refuse to
274
+ run without a changelog entry.
275
+
276
+ ## [0.3.0] - 2026-07-06
277
+
278
+ ### Added
279
+
280
+ - Git worktree and bare-repo layout support, with a worktree switcher
281
+ - Mouse support in the repo picker
282
+ - "Include uncommitted" checkbox rendered in the Compare view
283
+ - Auto-scroll to the latest changed file in auto mode
284
+
285
+ ### Fixed
286
+
287
+ - Follow mode not switching into a nested repository
288
+
289
+ ## [0.2.6] - 2026-03-08
290
+
291
+ ### Fixed
292
+
293
+ - Error spam when opening a non-git directory
294
+
295
+ ## [0.2.5] - 2026-03-06
296
+
297
+ ### Added
298
+
299
+ - Show application version in hotkeys modal footer
300
+
301
+ ## [0.2.4] - 2026-03-08
302
+
303
+ ### Added
304
+
305
+ - Repo picker modal (`r`) for switching between recent repositories
306
+ - Focus zone system for Tab/Shift-Tab navigation
307
+
308
+ ### Changed
309
+
310
+ - Commit tab stripped to the essentials: message input, amend, submit
311
+ - Modal state centralized in ModalController
312
+
313
+ ### Fixed
314
+
315
+ - `q` closing the app while a modal was open
316
+ - Hotkeys modal `?` toggle race condition
317
+ - History selection not updating after refresh
318
+
319
+ ## [0.2.3] - 2026-02-06
320
+
321
+ ### Added
322
+
323
+ - Repository control center on the commit tab
324
+ - Release script and documented release workflow
325
+
326
+ ### Changed
327
+
328
+ - File finder rebuilt on `git ls-files` with fzf matching
329
+
330
+ ## [0.2.2] - 2026-02-01
331
+
332
+ ### Added
333
+
334
+ - Hunk-level staging with toggle key, click selection, and per-file indicators
335
+ - Flat file view with combined interleaved diff
336
+ - fzf-powered file finder (Ctrl+P)
337
+ - Unit and integration tests for git and utility modules
338
+ - dependency-cruiser architecture layering rules
339
+ - Pre-push hook running tests before tag pushes
340
+
341
+ ### Fixed
342
+
343
+ - Phantom context line on the last hunk of a diff
344
+ - Selection desync on full-hunk staging
345
+ - Explorer mouse and keyboard bugs
346
+
347
+ ## [0.2.1] - 2026-01-30
348
+
349
+ ### Added
350
+
351
+ - Explorer tree view with git status, file finder, and selection anchor
352
+ - Code quality metrics tooling
353
+
354
+ ### Changed
355
+
356
+ - App.ts decomposed into KeyBindings, MouseHandlers, PaneRenderers, and FollowMode modules
357
+
358
+ ### Fixed
359
+
360
+ - Watcher cleanup and state refresh when switching repositories
361
+
362
+ ## [0.2.0] - 2026-01-27
363
+
364
+ ### Changed
365
+
366
+ - **Major rewrite**: Migrated from Ink (React for CLIs) to neo-blessed for native terminal rendering
367
+ - Significantly improved scroll performance - no more lag on large diffs
368
+ - More responsive UI with direct terminal control
369
+ - Reduced memory footprint
370
+ - Gitignore-aware file watching - no longer watches inside node_modules, dist, etc.
371
+
372
+ ### Added
373
+
374
+ - Base branch picker modal (`b` in Compare view) for selecting PR comparison base
375
+ - Discard confirmation dialog (`d` on unstaged files) with y/n prompt
376
+ - Toggle uncommitted changes in Compare view (`u`)
377
+ - External git operation detection - UI updates when staging/committing outside the app
378
+ - Explorer view (tab 5) for browsing repository files with syntax highlighting
379
+ - tmux-test.sh script for headless UI testing
380
+
381
+ ### Fixed
382
+
383
+ - Window resize now properly updates all UI elements
384
+ - Diff content no longer contains control characters
385
+ - Improved diff line alignment and file separation
386
+ - Modal key isolation - navigation keys no longer affect background list when modal is open
387
+ - Auto-scroll keeps selection visible when navigating in all list views
388
+ - Commit textarea focus no longer crashes the app
389
+ - Terminal cleanup on startup clears leftover mouse mode from previous crashes
390
+
391
+ ### Technical
392
+
393
+ - Replaced React hooks with event-driven state management
394
+ - Single source of truth pattern for scroll calculations
395
+ - Operation queue for serialized git operations
396
+ - Polling-based git watcher for reliable atomic write detection
397
+
398
+ ## [0.1.0] - 2026-01-21
399
+
400
+ ### Added
401
+
402
+ - Initial release
403
+ - Four views: Diff, Commit, History, and PR comparison
404
+ - Two-pane layout with resizable split
405
+ - Mouse support: click to select, stage/unstage, scroll, switch tabs
406
+ - Word-level diff highlighting
407
+ - 6 color themes including colorblind-friendly and ANSI-only variants
408
+ - Follow mode for shell integration
409
+ - Keyboard navigation with vim-style bindings
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 diffstalker contributors
3
+ Copyright (c) 2026 yogh-io
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -31,8 +31,7 @@ Options:
31
31
  ```
32
32
  --socket PATH Bind a unix socket at PATH
33
33
  (default: $XDG_RUNTIME_DIR/diffstalker/diffstalkerd.sock)
34
- --port N Bind TCP port N instead of a unix socket
35
- --host H Host to bind with --port (default: 127.0.0.1)
34
+ --port N Bind TCP port N (loopback only) instead of a unix socket
36
35
  --follow-file PATH Hook file to follow (created when missing)
37
36
  (default: ~/.cache/diffstalker/target)
38
37
  --no-follow Disable follow mode (no hook-file watcher)
@@ -60,8 +59,26 @@ deliberately no `/tmp` fallback. Pass `--socket PATH` explicitly instead.
60
59
  If a live daemon already answers on the socket path, startup fails; a stale
61
60
  socket file (nothing listening) is removed and reused.
62
61
 
63
- There is no authentication yet. Keep the daemon on a unix socket or
64
- localhost; a bearer-token check is planned before it may bind further.
62
+ The daemon has no authentication, so it binds **loopback only** — a unix
63
+ socket, or `--port` on `127.0.0.1`. There is no option to bind a routable
64
+ interface (bearer-token auth would be a prerequisite for that, and is not
65
+ implemented). On a port an
66
+ origin guard runs: a `Host` allow-list rejects rebound hostnames
67
+ (DNS-rebinding defense, 421), and state-changing requests with a cross-site
68
+ `Sec-Fetch-Site` or a non-loopback `Origin` are rejected (CSRF defense,
69
+ 403). Non-browser clients (the CLI, `curl`) send neither header and a
70
+ loopback `Host`, so they pass. Every response also carries hardening
71
+ headers (`X-Content-Type-Options`, `X-Frame-Options: DENY`,
72
+ `Referrer-Policy`, and a strict `Content-Security-Policy` for the served
73
+ SPA). To reach the daemon from another machine, forward the port over SSH
74
+ (`ssh -L`). See `SECURITY.md` at the repo root.
75
+
76
+ A `--port` daemon also exposes a **reduced API** (least privilege): only the
77
+ endpoints the web UI uses — reads, `POST`/`DELETE /repos`, and
78
+ `POST /repos/:id/stage`/`unstage`. The CLI-only mutations (commit, discard,
79
+ hunk staging, `PUT /compare/base`, and every remote/branch operation) are
80
+ not routed on a port; they exist only over the unix socket. Requesting one
81
+ on a port returns `404 Unknown route`.
65
82
 
66
83
  ## Environment
67
84