projview 0.8.0 → 0.8.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/README.md CHANGED
@@ -34,6 +34,9 @@ and exit (no server, no browser), so an agent or script can query your docs:
34
34
  ```bash
35
35
  projview search "<query>" [path] # ranked: filename matches + in-content hits w/ line snippets
36
36
  projview tree [path] # the file tree as JSON
37
+ projview comment add <file> "…" # leave a comment (--heading <id> to anchor a section)
38
+ projview comments [file] # list comments as JSON
39
+ projview usage [path] # views + searches recorded by the viewer
37
40
  projview search "mermaid" --demo # quick test on the bundled docs
38
41
  ```
39
42
 
@@ -53,9 +56,19 @@ projview search "mermaid" --demo # quick test on the bundled docs
53
56
  | index | builds an in-memory tree (nothing written to disk by default) |
54
57
  | serve | spawns a localhost site + opens your browser |
55
58
  | live | edits to files reload in the browser automatically |
59
+ | comment | leave notes on a file, a section, or a text selection (browser or CLI) |
56
60
 
57
61
  > ephemeral by default - ctrl-c and it's gone. opt into persistence below.
58
62
 
63
+ ## comments
64
+
65
+ Leave notes on a whole file, a heading/section, or a selected passage - from the
66
+ viewer (the 💬 button, bottom-right) or via the CLI / HTTP API. Text comments
67
+ **re-anchor** as the doc changes and only flag themselves *orphaned* if the quoted
68
+ text truly disappears. Comments persist when you opt into a store
69
+ (`--persist` / `--store-url`); writes are **localhost-only** (an exposed instance
70
+ is read-only).
71
+
59
72
  ## persistence (opt-in)
60
73
 
61
74
  By default the index is in-memory and nothing is written to disk. Opt in for a
@@ -67,7 +67,7 @@ npm install
67
67
  npm run demo # preview the bundled docs/ (alias for --demo)
68
68
  npm start # index the current directory
69
69
  node bin/projview.js ./docs # or call the CLI directly
70
- npm test # run the test suite (node:test, 45 tests)
70
+ npm test # run the test suite (node:test, 49 tests)
71
71
  ```
72
72
 
73
73
  See the [project README](README.md) for the architecture and the
@@ -12,15 +12,36 @@ state it records is its own usage events (views / searches) into the store.
12
12
 
13
13
  ### GET /api/tree
14
14
 
15
- Returns the in-memory file tree as JSON.
15
+ Returns the in-memory file tree as JSON, plus the `version` and a `writable`
16
+ flag (false when projview is exposed on a non-loopback host).
16
17
 
17
18
  ### GET /api/file
18
19
 
19
20
  Renders a single file to HTML on demand. Query param `p` is the relative path.
21
+ Records a `view` usage event.
20
22
 
21
23
  ### GET /api/events
22
24
 
23
- Server-sent events stream for live reload.
25
+ Server-sent events stream: `change` / `tree` for live reload, `comments` when a
26
+ comment is created/edited/deleted.
27
+
28
+ ### GET /api/comments
29
+
30
+ Lists comments as JSON. Optional `?file=<path>` filters to a single file.
31
+
32
+ ### POST /api/comments
33
+
34
+ Creates a comment from `{ file, body, anchor?, author? }`. **Loopback only** -
35
+ returns `403` when bound to a non-loopback host. Author defaults to the server's
36
+ git/OS user when omitted.
37
+
38
+ ### PATCH /api/comments/:id · DELETE /api/comments/:id
39
+
40
+ Resolve/edit (`{ resolved?, body? }`) or delete a comment. Loopback only.
41
+
42
+ ### GET /api/usage
43
+
44
+ Aggregated usage: `{ total, byType, topFiles[], recentSearches[] }`.
24
45
 
25
46
  ## machine interface (CLI)
26
47
 
@@ -115,6 +136,13 @@ On-demand fetch + render, in-app link routing, anchor jumps.
115
136
 
116
137
  A chokidar watcher broadcasts change/tree events over SSE.
117
138
 
139
+ ### comments
140
+
141
+ A drawer (the 💬 button, bottom-right) lists comments for the open file. Add one
142
+ by selecting text, hovering a heading, or "+ note". Text anchors re-anchor on
143
+ each render and paint via the CSS Custom Highlight API; create/resolve/delete
144
+ controls hide when the server isn't writable.
145
+
118
146
  ## stores (persistence)
119
147
 
120
148
  The index - plus **comments** and **usage events** - is in-memory by default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projview",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Ephemeral local previewer for markdown + mermaid files in any directory",
5
5
  "type": "module",
6
6
  "bin": {