diffstalkerd 0.8.1 → 0.9.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 CHANGED
@@ -5,7 +5,106 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [Unreleased]
8
+ ## [0.9.0] - 2026-07-28
9
+
10
+ ### Fixed
11
+
12
+ - **A worktree is named by its directory everywhere, and its branch is
13
+ never hidden.** The switcher's trigger showed the directory while its
14
+ rows showed the branch, so a `main` worktree with a feature branch
15
+ checked out read as two different names depending on where you looked.
16
+ Worse, the header suppressed the branch name in the breadcrumb whenever
17
+ it matched "what the switcher shows" — computed the row way, not the
18
+ trigger way — so in exactly that case the current branch appeared
19
+ nowhere in plain text. The switcher now names the PLACE (the directory)
20
+ in both, and a row carries the checked-out branch on its own line when
21
+ it differs from the directory name; a detached worktree says "detached"
22
+ in its meta line. The breadcrumb states the branch whenever the switcher
23
+ is not already showing that exact word.
24
+ - **The upstream shortens to its remote when it adds nothing.** A branch
25
+ tracking the same name upstream printed it twice
26
+ (`aer-4569-x → origin/aer-4569-x`); it now reads `aer-4569-x → origin`,
27
+ with the full ref on hover. A genuinely different upstream branch
28
+ (`main → upstream/release-2025.1`) is still spelled out.
29
+ - **Project identity now comes from git, not from path shape.** Worktrees
30
+ were grouped by their deepest common parent directory, which assumed a
31
+ layout: worktrees parked as SIBLINGS of the repo (`…/proj` +
32
+ `…/proj-fix`) share only their parent, so the project was named after
33
+ whatever directory the user happens to keep repos in. Grouping is now
34
+ the repository's MAIN worktree (`git worktree list` reports it first,
35
+ exposed as `isMain` on `WorktreeInfo`), which exists in every layout —
36
+ nested under the repo, sibling, bare-with-worktrees, scattered across
37
+ unrelated directories, or no worktrees at all. A bare main names the
38
+ project from its directory (`…/proj/.bare` → `proj`, `…/proj.git` →
39
+ `proj`). One test per layout.
40
+ - **The repo picker no longer forgets recent repos.** Opening or closing a
41
+ repo — which every repo switch does — cleared the whole worktree cache,
42
+ and recents deliberately do not render until resolved, so the Recent
43
+ list emptied on every switch and re-resolved from scratch. Cache entries
44
+ are now marked stale instead of dropped: the last good answer keeps
45
+ rendering while a re-read runs in the background.
46
+ - **The repo and worktree switchers no longer disagree, and the picker no
47
+ longer depends on when it was opened.** The header could show one
48
+ project's name next to another repo's worktree name, and the panel's
49
+ rows could be populated differently from one opening to the next.
50
+ Three separate caches were answering the same question — the active
51
+ repo's worktrees (a bare list in the daemon store, replaced only when a
52
+ fetch happened to land), the picker's per-repo-id project map, and the
53
+ recents' per-path map — over two endpoints, with three lifetimes and no
54
+ sharing. They are replaced by one `worktrees` store keyed by filesystem
55
+ path, with explicit per-entry state (pending / ready / absent /
56
+ failed), in-flight dedup, and invalidation when the open-repo set
57
+ changes. Every surface derives from the ACTIVE PATH, so a switch of any
58
+ kind — picker, worktree dropdown, follow mode, URL, SSE reconnect —
59
+ cannot leave the previous repo's data on screen, and a failed or
60
+ out-of-order lookup can never be attributed to the wrong repo. Opening
61
+ the worktree dropdown now re-reads its "edited N ago" / commits-ahead
62
+ data without blanking the list while it does.
63
+
64
+ ### Changed
65
+
66
+ - **Compare's diffs follow the tree order.** The file tree groups a
67
+ directory's sub-directories before its loose files; the diff stack below
68
+ kept the daemon's flat path sort, so the two read in different orders as
69
+ soon as a directory held both. The stack now renders in tree order, so
70
+ scrolling the diffs walks the tree. Collapsing a directory is a tree
71
+ affordance only — it never reorders the diffs or drops one.
72
+ - **Diffs are no longer sent twice.** Every diff carried both its raw text
73
+ and the parsed lines that text produces — the raw was a third of every
74
+ diff response, and doubled what the journal retains in memory. `lines`
75
+ is now the only representation; the raw text is derived where it is
76
+ actually needed (hunk staging, hunk counting, per-file splitting) via
77
+ `rawFromLines`. Combined with the size cap below, a large branch compare
78
+ went from 53 MB to 7.2 MB. An empty diff now parses to NO lines rather
79
+ than one phantom blank line, so the round-trip is exact.
80
+ - **Oversized file diffs are announced, not sent.** A single file's diff
81
+ over 256 KB or 5,000 lines is no longer transferred or rendered: the
82
+ file keeps its header, stats, and place in the list, and its body is one
83
+ line — `Large file — diff not shown (5.7 MB, 121,235 lines)`. This is
84
+ the same shape git already uses for binary files, so both cases now
85
+ render through one placeholder everywhere (Changes, Compare, History,
86
+ Journal, Explorer diffs). The cap is applied in core, so every diff the
87
+ daemon serves gets it. On a real branch compare (841 files) this took
88
+ the response from 53 MB to 10.6 MB, withholding six files. The two
89
+ limits are `MAX_FILE_DIFF_BYTES` / `MAX_FILE_DIFF_LINES` in
90
+ `core/git/diffParse`; the byte cap is the one that catches long-line
91
+ files (minified bundles, exported SVGs) that the line cap misses.
92
+ - An untracked file too big to read now gets that same notice instead of
93
+ an empty diff, which used to read as "no changes".
94
+
95
+ ### Added
96
+
97
+ - **Version indicator in the web UI's status bar.** The far right of the
98
+ status bar shows the running version and whether it matches what npm
99
+ publishes: dim `v0.8.1` when it matches, `v0.8.1 → 0.9.0` in the warn
100
+ color when a newer version is out, the accent color for a local build
101
+ ahead of npm. New daemon endpoint `GET /version` backs it — it reads the
102
+ running version from the daemon's own package manifest and compares it
103
+ with npm's `latest` dist-tag, cached six hours (five minutes after a
104
+ failed lookup) and fetched only when a client asks. The new
105
+ `--no-update-check` flag turns the npm lookup off entirely; offline or
106
+ opted out, the running version still shows and the comparison reads
107
+ unknown.
9
108
 
10
109
  ## [0.8.1] - 2026-07-28
11
110
 
package/README.md CHANGED
@@ -38,6 +38,8 @@ Options:
38
38
  --web-root PATH Directory of built web-UI assets to serve at GET /
39
39
  (default: ./web next to the daemon bundle; the published
40
40
  package ships it there. Missing dir → API-only, non-fatal)
41
+ --no-update-check Never ask npm which version is latest; GET /version
42
+ then reports the running version only
41
43
  --help, -h Show this help
42
44
  ```
43
45
 
@@ -116,13 +118,14 @@ values are rejected with a 400 so they can never be parsed as git flags.
116
118
  | Method | Path | What |
117
119
  | ------ | -------------------------- | ------------------------------------------------ |
118
120
  | GET | `/health` | `{ok, ready}` |
121
+ | GET | `/version` | `{current, latest, status}` — the running version against npm's `latest` dist-tag (`current` \| `outdated` \| `ahead` \| `unknown`). The npm lookup is cached (6h, 5min after a failure) and only ever runs when this endpoint is called; `--no-update-check` skips it, leaving `latest: null` |
119
122
  | GET | `/repos` | List open repos (`id`, `path`, `branch`) |
120
123
  | POST | `/repos` | Open a repo: `{"path": "/abs/path"}` → `{id, path}` (201 created, 200 already open) |
121
124
  | DELETE | `/repos/:id` | Close a repo (refcounted per open) |
122
125
  | GET | `/repos/:id/worktrees` | Registered worktrees (`path`, `branch`, `head`, `isBare`, `lastActivity`, `aheadOfBase`): main worktree, linked worktrees, and the bare entry in a bare-worktree layout |
123
126
  | GET | `/worktrees?path=` | Same as above, but for a raw filesystem path instead of an already-opened repo id (e.g. a recently-visited repo a client hasn't opened on this daemon) |
124
127
  | GET | `/repos/:id/status` | Shared state: status, hunk counts, stash list, in-progress operation, error, working-file mtimes (path → mtimeMs; what browser clients build mtime-based auto mode on) |
125
- | GET | `/repos/:id/diff?path=&staged=` | Diff; whole tree without `path`, staged side with `staged=true` |
128
+ | GET | `/repos/:id/diff?path=&staged=` | Diff; whole tree without `path`, staged side with `staged=true`. Per-file cap: a file's diff over 256 KB or 5,000 lines is withheld — its headers are kept and its body becomes one `Large file — diff not shown (…)` line, the same shape git uses for `Binary files … differ`. Applies to every diff-bearing response (compare, commit diffs, journal) |
126
129
  | GET | `/repos/:id/history?count=` | Commit history (`CommitInfo[]`, default 100, ISO dates) |
127
130
  | GET | `/repos/:id/commits/:hash/diff` | Diff introduced by one commit (404 on unknown hash; merge and `--allow-empty` commits are 200 with an empty diff, matching the CLI) |
128
131
  | GET | `/repos/:id/head-message` | HEAD commit message for amend prefill: `{message}` (`""` when the repo has no commits) |