diffstalkerd 0.11.0 → 0.12.1

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,111 @@ 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.12.1] - 2026-08-10
9
+
10
+ ### Changed
11
+
12
+ - **The keyboard shortcut sheet (`?`) was redesigned.** It was one 18-row
13
+ "Global" block against six three-row ones in a two-column grid, and a grid
14
+ row is as tall as its tallest cell — so most of the sheet sat behind a
15
+ scrollbar next to a large empty rectangle, and widening the dialog only
16
+ widened the rectangle. The content is re-cut into nine groups of at most five
17
+ rows, named for what you are trying to do, and flowed into CSS columns: four
18
+ on a laptop with all 35 shortcuts visible at once and no scrollbar, three at
19
+ 1024px, two on a tablet, one on a phone in priority order. No breakpoint is
20
+ involved — the column count is a function of the width.
21
+
22
+ ### Fixed
23
+
24
+ - The shortcut sheet listed `F` for content search, which is Shift+F and did
25
+ nothing as written, and gave `Enter / Space` as one row in lists though Enter
26
+ hands focus to the diff and Space keeps it in the list. Four live bindings it
27
+ never mentioned are now on it: `j`/`k` in the stacked layout, arrow keys
28
+ resizing a divider, Enter or Space folding a commit in the Journal, and
29
+ typing to narrow the outline.
30
+ - The shortcut sheet and the settings panel both budgeted their height as
31
+ `100vh - 4rem` while the scrim above them already pushed them down by up to
32
+ `8rem`. On a short window their last rows sat below a scrim that has no
33
+ scrollbar of its own — clipped, with no way to reach them.
34
+ - The shortcut list takes a tab stop, so it can be scrolled without a pointer.
35
+
36
+ ## [0.12.0] - 2026-08-09
37
+
38
+ ### Added
39
+
40
+ - **Settings panel** in the web UI (gear in the header, or `,`). It separates
41
+ what belongs to this browser (theme) from what belongs to the daemon's
42
+ machine (below), and says which is which. The theme picker moved into it
43
+ from the header, where a permanently parked select cost more room than a
44
+ set-once choice earns.
45
+ - **Watch directories**: point diffstalker at the folder you keep projects in,
46
+ and every git repository in it appears in the repo switcher ready to open —
47
+ no more typing an absolute path per repo. The setting lives with the daemon
48
+ (`~/.config/diffstalker/daemon.json`), so every client sees the same list and
49
+ it survives a restart. New endpoints `GET`/`PUT /settings`, `GET /discovered`
50
+ and `POST /discovered/rescan`, plus `settings-change` / `discovery-change` on
51
+ the daemon SSE channel.
52
+
53
+ A **Browse…** button picks the directory by walking the daemon's own
54
+ filesystem (new `GET /browse`, directory names only, repos marked so you can
55
+ pick their parent). It has to work that way: a browser is never handed a real
56
+ path by its own file pickers, so nothing client-side could name a directory
57
+ the daemon could then open.
58
+
59
+ Discovery lists repos, it never opens them. The scan runs no git at all: a
60
+ directory holding `.git` is a repo, its branch comes from `.git/HEAD`, and
61
+ its last activity from the git dir's mtimes. It looks at the root's children
62
+ and one level deeper, stops at the first `.git` (so submodules are never
63
+ listed as projects), skips dot-dirs and `node_modules`, and is capped at 500
64
+ with the cap reported. Each root is watched, so a fresh clone shows up
65
+ without a reload.
66
+
67
+ The list is ordered most-recently-touched first, with the age beside each
68
+ path: a projects folder is mostly archaeology, so anything untouched for six
69
+ months sinks and dims rather than competing with this week's work. Past eight
70
+ projects the list grows a filter field.
71
+
72
+ ### Fixed
73
+
74
+ A sweep of small things across the web UI — the kind that only show up in real
75
+ use:
76
+
77
+ - The header and the status bar phrased one dropped connection two different
78
+ ways at the same moment; they now share the one sentence.
79
+ - Escape closing a panel used to drop focus on the floor, so the arrow keys
80
+ stopped working: the file-list filter, and the outline popover, now hand
81
+ focus back to where it came from.
82
+ - Escape in the settings panel's directory browser closed the whole panel
83
+ (and the path you had typed). It backs out of the browser first.
84
+ - The journal's commit fold was mouse-only despite announcing itself as a
85
+ button — Enter and Space work now, and it takes a tab stop.
86
+ - Pressing `o` in the Explorer with no file open did nothing at all, though
87
+ the help advertises it; it now opens the popover, which says "No file open."
88
+ - The outline said "Outline not loaded." while it was still loading, which
89
+ reads as a verdict. It says "Loading outline…", and a failed request lands
90
+ on the real unavailable state instead of spinning forever.
91
+ - A failed *optional* outline re-read replaced the file you were reading with
92
+ one line of error text. The file stays.
93
+ - The Explorer's filter toggles kept the same tooltip whichever way they were
94
+ set, so the tooltip described the opposite of what a click would do.
95
+ - A long branch name painted straight over the arrow and the ahead/behind
96
+ counts instead of ellipsizing.
97
+ - Adding a watch directory that was already there looked exactly like a
98
+ successful add (the daemon dedupes silently); it now says so. A refusal no
99
+ longer greets you again the next time you open the panel.
100
+ - Browsing to a path that does not exist opened a dead picker with every
101
+ button disabled; it falls back to home and still says why. Two quick clicks
102
+ on a slow mount could land you in the folder you did not pick.
103
+ - Truncation and naming: the filter chip said "1 changed files", the clean-tree
104
+ line was not a sentence and named two of its three cases, the Discovered list
105
+ called repos "projects" while the settings panel called them repos, the
106
+ outline squeezed away the symbol name to keep its parent, and the browse
107
+ bar chopped paths with no ellipsis.
108
+ - Accessibility: the activity rail announced the Changes tab as "(12)" in the
109
+ icon-only band, the tree-refresh and parent-directory glyphs had no name, and
110
+ arrowing through search hits announced nothing.
111
+ - The daemon's save failure read "Could not save settings: Error: EACCES…",
112
+ with the exception's own prefix glued into the sentence.
9
113
 
10
114
  ## [0.11.0] - 2026-08-06
11
115
 
package/README.md CHANGED
@@ -217,13 +217,18 @@ values are rejected with a 400 so they can never be parsed as git flags.
217
217
  | GET | `/repos/:id/files` | All tracked + untracked (not ignored) paths: the fuzzy-finder source |
218
218
  | GET | `/repos/:id/journal?since=` | Append-only edit journal: `{epoch, prunedBefore, entries}`; `since=<seq>` returns only entries with a higher seq (all when omitted) |
219
219
  | GET | `/repos/:id/events` | SSE: `snapshot` on connect, then `state-change` events from the file watcher and `journal-append {entries}` per journal observation |
220
- | GET | `/events` | Daemon-scope SSE: `snapshot` (open repos) on connect, then `repo-opened` / `repo-closed` / `follow-change` |
220
+ | GET | `/events` | Daemon-scope SSE: `snapshot` (open repos) on connect, then `repo-opened` / `repo-closed` / `follow-change` / `settings-change` / `discovery-change` |
221
221
  | GET | `/follow` | Follow state: `{targetFile, enabled, followedRepoId, followedPath}` |
222
+ | GET | `/settings` | Daemon settings: `{watchRoots, persisted}`. `persisted: false` means this daemon holds them in memory only (no settings file) |
223
+ | GET | `/discovered` | Repos found under the watch directories: `{roots: [{path, repos: [{path, name, branch, lastActivity}], error, capped}]}`. See [Watch directories](#watch-directories) |
224
+ | GET | `/browse?path=` | One directory level of the daemon's filesystem, for picking a watch directory: `{path, parent, home, entries: [{name, path, isRepo}]}`. Directory names only — no files, no dot directories. No `path` starts at the daemon's home; 400 for a relative path, 404 for one it cannot read |
222
225
 
223
226
  ### Mutations (all respond `{state, result?}`)
224
227
 
225
228
  | Method | Path | Body / behavior |
226
229
  | ------ | -------------------------- | ------------------------------------------------ |
230
+ | PUT | `/settings` | Replace the settings: `{"watchRoots": ["/abs/dir", "~/projects"]}` → `{watchRoots, persisted}`. Whole document, not a patch. Each path is expanded, made absolute and checked to be an existing directory; a refusal is a 400 naming the path, and nothing is saved |
231
+ | POST | `/discovered/rescan` | Re-walk every watch directory now and return the new `{roots}` (filesystem only, no git processes) |
227
232
  | POST | `/repos/:id/stage` | `{"path": "file.txt"}` — stage one file (404 when not in status) |
228
233
  | POST | `/repos/:id/unstage` | `{"path": "file.txt"}` — unstage one file |
229
234
  | POST | `/repos/:id/stage-all` | Stage everything |
@@ -391,6 +396,51 @@ sec-fetch-dest`, and either `cache-control: no-store` (`side=worktree`, whose
391
396
  bytes can change under us) or `cache-control: private, no-cache` plus an
392
397
  `etag` of the object id (`side=index|head`, which are immutable).
393
398
 
399
+ ## Watch directories
400
+
401
+ A watch directory is a folder the user keeps projects in. The daemon scans
402
+ each configured one for git repositories and keeps that list live, so a
403
+ client can offer "your projects" instead of an empty path field — a browser
404
+ cannot browse the daemon's filesystem, and this is what replaces typing an
405
+ absolute path every time.
406
+
407
+ Discovery LISTS repos; it never opens them. Opening is what starts a
408
+ watcher and git state per repo, so a folder with fifty projects would
409
+ otherwise cost fifty of each. A discovered repo is `{path, name, branch}`
410
+ until a client calls `POST /repos` for it.
411
+
412
+ The scan is filesystem-only — no git process. A directory holding a `.git`
413
+ entry is a repo, and its branch is read from `.git/HEAD` (a short sha when
414
+ detached). It looks at the root's children, and one level further inside a
415
+ child that is not itself a repo (so `~/projects/work/thing` is found), and
416
+ stops descending as soon as it finds a repo — a repo's own subdirectories,
417
+ submodules included, are never listed as projects. Dot directories,
418
+ `node_modules` and friends are skipped, symlinked directories are not
419
+ followed, and the list is capped (500 repos, reported as `capped: true`
420
+ rather than silently trimmed). A leftover worktree directory whose git dir
421
+ has been pruned is dropped: it would only produce "not a git repository"
422
+ when clicked.
423
+
424
+ A client picks a watch directory through `GET /browse`, which walks the
425
+ daemon's directories one level at a time. That has to happen here: a browser
426
+ is never handed a real path by its own file pickers (`webkitdirectory` gives
427
+ relative names, `showDirectoryPicker` a bare handle), so the one thing this
428
+ API needs — an absolute path on the daemon's machine — is exactly what the
429
+ page cannot produce.
430
+
431
+ Each root also gets a chokidar watcher one level deep, so a clone appearing
432
+ in the folder shows up without anyone reloading; directory add/remove is
433
+ the only thing it reacts to, debounced. The watcher deliberately does not
434
+ look inside a repo's `.git`, so a branch label can lag a checkout made
435
+ elsewhere — `POST /discovered/rescan` is how a client refreshes it.
436
+
437
+ Settings persist in `~/.config/diffstalker/daemon.json` (or
438
+ `$XDG_CONFIG_HOME`), written atomically and re-read at startup. A root that
439
+ is configured but currently unreadable (an unmounted disk) keeps its place
440
+ in the settings and is reported with an `error` — it is never quietly
441
+ dropped. Both `/settings` and `/discovered` are served on every transport,
442
+ including a `--port` listener: the settings UI lives in the web client.
443
+
394
444
  ## Follow mode
395
445
 
396
446
  The daemon owns the truth, clients decide policy. It watches ONE hook file
@@ -426,4 +476,6 @@ curl --unix-socket "$SOCK" -X POST -d '{"path": "file.txt"}' http://localhost/re
426
476
  curl --unix-socket "$SOCK" -N http://localhost/repos/<id>/events
427
477
  curl --unix-socket "$SOCK" -N http://localhost/events
428
478
  curl --unix-socket "$SOCK" http://localhost/follow
479
+ curl --unix-socket "$SOCK" -X PUT -d '{"watchRoots": ["~/projects"]}' http://localhost/settings
480
+ curl --unix-socket "$SOCK" http://localhost/discovered
429
481
  ```