collabmd 0.1.18 → 0.1.20

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 (64) hide show
  1. package/README.md +107 -25
  2. package/docker-compose.yml +1 -1
  3. package/package.json +1 -1
  4. package/public/assets/css/style.css +1 -1
  5. package/public/assets/js/chunks/{preview-render-compiler-WD3A76I6.js → chunk-5QRWYPYT.js} +18 -18
  6. package/public/assets/js/chunks/chunk-HEWVH67U.js +9 -0
  7. package/public/assets/js/chunks/chunk-R3DDMJHH.js +1 -0
  8. package/public/assets/js/chunks/editor-session-TAV2VXTA.js +22 -0
  9. package/public/assets/js/chunks/preview-render-compiler-UZ4SZDQQ.js +1 -0
  10. package/public/assets/js/chunks/quick-switcher-controller-J7I3CUET.js +5 -0
  11. package/public/assets/js/{excalidraw-editor-LKW2AZBU.js → excalidraw-editor-ZDYKMZOL.js} +33 -33
  12. package/public/assets/js/excalidraw-editor.js +1 -1
  13. package/public/assets/js/main.js +100 -73
  14. package/public/assets/js/preview-render-worker.js +19 -19
  15. package/public/index.html +14 -4
  16. package/src/client/application/app-shell/git-feature.js +29 -1
  17. package/src/client/application/app-shell/presence-feature.js +2 -1
  18. package/src/client/application/app-shell/ui-feature.js +113 -1
  19. package/src/client/application/app-shell/workspace-feature.js +9 -0
  20. package/src/client/application/app-shell-elements.js +1 -0
  21. package/src/client/application/preview-render-compiler.js +55 -5
  22. package/src/client/application/preview-render-executor.js +8 -0
  23. package/src/client/application/preview-render-worker.js +13 -2
  24. package/src/client/application/preview-renderer.js +5 -0
  25. package/src/client/application/workspace-chrome-controller.js +12 -1
  26. package/src/client/application/workspace-coordinator.js +16 -7
  27. package/src/client/application/workspace-preview-controller.js +45 -5
  28. package/src/client/application/workspace-route-controller.js +4 -0
  29. package/src/client/bootstrap/collabmd-app-shell.js +19 -3
  30. package/src/client/domain/room.js +37 -0
  31. package/src/client/domain/vault-utils.js +46 -0
  32. package/src/client/infrastructure/comment-thread-store.js +98 -0
  33. package/src/client/infrastructure/editor-paste-utils.js +45 -0
  34. package/src/client/infrastructure/editor-session.js +10 -0
  35. package/src/client/infrastructure/editor-view-adapter.js +98 -7
  36. package/src/client/infrastructure/vault-api-client.js +17 -0
  37. package/src/client/presentation/backlinks-panel.js +157 -101
  38. package/src/client/presentation/comment-markdown-renderer.js +68 -0
  39. package/src/client/presentation/comment-ui-controller.js +352 -20
  40. package/src/client/presentation/file-explorer-controller.js +5 -0
  41. package/src/client/presentation/file-explorer-view.js +10 -2
  42. package/src/client/presentation/file-tree-state.js +7 -1
  43. package/src/client/presentation/git-panel-controller.js +73 -0
  44. package/src/client/presentation/image-lightbox-controller.js +394 -0
  45. package/src/client/presentation/outline-controller.js +25 -0
  46. package/src/client/styles/style.css +677 -21
  47. package/src/domain/comment-threads.js +95 -13
  48. package/src/domain/file-kind.js +16 -1
  49. package/src/server/infrastructure/git/errors.js +4 -1
  50. package/src/server/infrastructure/git/git-service.js +215 -1
  51. package/src/server/infrastructure/http/create-git-api-command-handler.js +6 -1
  52. package/src/server/infrastructure/http/create-git-api-query-handler.js +16 -1
  53. package/src/server/infrastructure/http/create-vault-api-command-handler.js +48 -2
  54. package/src/server/infrastructure/http/create-vault-api-query-handler.js +67 -1
  55. package/src/server/infrastructure/http/request-body.js +11 -2
  56. package/src/server/infrastructure/persistence/path-utils.js +1 -1
  57. package/src/server/infrastructure/persistence/pull-backup-store.js +283 -0
  58. package/src/server/infrastructure/persistence/vault-file-store.js +203 -2
  59. package/public/assets/js/chunks/chunk-BBHPYU2R.js +0 -1
  60. package/public/assets/js/chunks/chunk-OG2TNZEU.js +0 -9
  61. package/public/assets/js/chunks/chunk-QSTBGTWJ.js +0 -1
  62. package/public/assets/js/chunks/chunk-SR3U53EQ.js +0 -1
  63. package/public/assets/js/chunks/editor-session-IHFTYG5D.js +0 -22
  64. package/public/assets/js/chunks/quick-switcher-controller-JYDIJVAJ.js +0 -5
package/README.md CHANGED
@@ -1,26 +1,61 @@
1
1
  # CollabMD
2
2
 
3
- Browser collaboration for existing markdown folders, diagram files, and git-backed docs.
3
+ Realtime collaboration for Markdown folders, diagrams, and git-backed docs, without migrating your files.
4
4
 
5
5
  <p align="center">
6
- <img src="./docs/assets/collabmd-hero.png" alt="CollabMD showing a file tree, markdown editor, live preview, and collaborator presence." width="100%">
6
+ <img src="https://raw.githubusercontent.com/andes90/collabmd/master/docs/assets/collabmd-hero.webp" alt="CollabMD showing a file tree, markdown editor, live preview, and collaborator presence." width="100%">
7
7
  </p>
8
8
 
9
9
  <p align="center">
10
10
  <strong>Turn an existing markdown-and-diagram workspace into a realtime collaborative web app.</strong>
11
11
  </p>
12
12
 
13
- <p align="center">
14
- No migration. Plain files stay on disk. Collaborators get live editing, source-anchored comments, chat, Markdown video embeds, Mermaid, PlantUML, Excalidraw, and vault-style navigation in the browser.
15
- </p>
13
+ CollabMD turns a local Markdown folder, Obsidian-style vault, or docs repo into a collaborative workspace you can open in the browser.
14
+
15
+ Throughout this guide, **vault** simply means a regular folder on your computer that contains Markdown files.
16
+
17
+ - No migration: your files stay on disk
18
+ - Your filesystem stays the source of truth: CollabMD does not move, rename, or delete files unless you explicitly do that in the app
19
+ - Realtime editing with Yjs
20
+ - Mermaid, PlantUML, and Excalidraw support
21
+ - Source-anchored comments, chat, and presence
22
+ - Works with plain folders, Obsidian-style vaults, and git-backed docs
23
+
24
+ Requirements for the fastest first run:
25
+
26
+ - Node.js 24 for `npx` and source installs
27
+ - Homebrew only if you want the `brew install` path
28
+
29
+ ## Quick start
30
+
31
+ ```bash
32
+ # Run locally first, no Cloudflare tunnel required
33
+ npx collabmd@latest ~/my-vault --no-tunnel
34
+ ```
35
+
36
+ Open `http://localhost:1234`.
37
+
38
+ Expected startup output:
39
+
40
+ ```text
41
+ CollabMD v0.x.y
42
+ Vault: /path/to/your-vault
43
+ Local: http://localhost:1234
44
+ Tunnel: disabled
45
+ Ready for collaboration. Press Ctrl+C to stop.
46
+ ```
47
+
48
+ Prefer Homebrew or source install? Jump to [Installation options](#installation-options).
16
49
 
17
50
  ## See it in action
18
51
 
19
- ![CollabMD live demo](./docs/assets/collabmd-demo.gif)
52
+ See CollabMD editing the same workspace from two browsers in realtime:
20
53
 
21
- Prefer video? [Open the WebM demo](./docs/assets/collabmd-demo.webm).
54
+ ![Two browser windows editing the same markdown workspace in realtime](https://raw.githubusercontent.com/andes90/collabmd/master/docs/assets/collabmd-demo.gif)
22
55
 
23
- ## Why teams use CollabMD
56
+ Prefer video? [Open the WebM demo](https://raw.githubusercontent.com/andes90/collabmd/master/docs/assets/collabmd-demo.webm).
57
+
58
+ ## Features
24
59
 
25
60
  - **No migration** — point CollabMD at an existing markdown folder, diagram workspace, Obsidian-style vault, or git-backed docs repo
26
61
  - **Local-files-first** — your filesystem remains the source of truth
@@ -40,12 +75,22 @@ Prefer video? [Open the WebM demo](./docs/assets/collabmd-demo.webm).
40
75
  - Editing notes and diagrams together while keeping everything as plain files on disk
41
76
  - Giving browser access to collaborators who do not use your local markdown setup
42
77
 
43
- ## Quick start
78
+ ## Installation options
44
79
 
45
80
  ### Requirements
46
81
 
47
- - macOS or Linux
48
- - Node.js 24 if installing from source
82
+ - macOS, Linux, or Windows (via WSL2)
83
+ - Node.js 24 for `npx` and source installs
84
+
85
+ ### Run via npx (Node.js)
86
+
87
+ If you have Node.js installed, you can run CollabMD directly without installing it globally:
88
+
89
+ ```bash
90
+ npx collabmd@latest ~/my-vault --no-tunnel
91
+ ```
92
+
93
+ Open `http://localhost:1234`.
49
94
 
50
95
  ### Install with Homebrew
51
96
 
@@ -91,6 +136,16 @@ collabmd ~/my-vault --auth password
91
136
 
92
137
  If `cloudflared` is installed, CollabMD starts a quick tunnel by default unless you pass `--no-tunnel`.
93
138
 
139
+ ## Share with a collaborator
140
+
141
+ If you want to share the workspace over the internet, start with password auth:
142
+
143
+ ```bash
144
+ collabmd ~/my-vault --auth password
145
+ ```
146
+
147
+ Then share the printed URL and password with your collaborator. If `cloudflared` is installed, CollabMD will start a quick tunnel automatically unless you pass `--no-tunnel`.
148
+
94
149
  ## Safety first
95
150
 
96
151
  - Treat the URL as write access to the vault unless you enable auth
@@ -98,6 +153,13 @@ If `cloudflared` is installed, CollabMD starts a quick tunnel by default unless
98
153
  - If `cloudflared` is installed, CollabMD may expose the app through a Cloudflare Quick Tunnel unless you pass `--no-tunnel`
99
154
  - `oidc` is reserved for a future implementation and is not usable yet
100
155
 
156
+ ## Current limitations
157
+
158
+ - Single-instance deployment only: collaboration room state is kept in-process and is not shared across replicas
159
+ - `oidc` auth is reserved for a future implementation and is not usable yet
160
+ - Source-anchored comments currently support markdown, Mermaid, and PlantUML text files, but not `.excalidraw`
161
+ - Windows use is supported via WSL2 rather than native Windows execution
162
+
101
163
  ## How it works
102
164
 
103
165
  ```bash
@@ -119,7 +181,7 @@ Comment threads are source-anchored and currently supported for markdown, Mermai
119
181
 
120
182
  Markdown video embeds are opt-in and use standard image syntax such as `![Video](https://www.youtube.com/watch?v=...)` or `![Video](https://cdn.example.com/demo.webm)`. The preview currently supports public YouTube URLs plus direct public `https` video files ending in `.mp4`, `.webm`, or `.ogg`. The editor toolbar also includes a `Video` action that inserts the same Markdown syntax for you.
121
183
 
122
- Your filesystem is the source of truth. CollabMD reads files from disk, uses Yjs for realtime collaboration, and writes plain text back to disk when the last editor disconnects.
184
+ Your filesystem is the source of truth. CollabMD reads files from disk, uses Yjs for realtime collaboration, and continuously writes plain text back to disk as you type.
123
185
 
124
186
  ## Usage
125
187
 
@@ -139,7 +201,7 @@ collabmd [directory] [options]
139
201
  |--------|-------------|---------|
140
202
  | `-p, --port` | Port to listen on | `1234` |
141
203
  | `--host` | Host to bind to | `127.0.0.1` |
142
- | `--auth` | Auth strategy: `none`, `password`, `oidc` | `none` |
204
+ | `--auth` | Auth strategy: `none`, `password`, `oidc` (`oidc` is reserved and not yet available) | `none` |
143
205
  | `--auth-password` | Password for `--auth password` | generated per run |
144
206
  | `--local-plantuml` | Start the bundled local docker-compose PlantUML service | off |
145
207
  | `--no-tunnel` | Don't start Cloudflare Tunnel | tunnel on |
@@ -171,11 +233,17 @@ collabmd --local-plantuml
171
233
  collabmd ~/Documents/Obsidian/MyVault
172
234
  ```
173
235
 
174
- ## Cloudflare Tunnel
236
+ ## Public access
175
237
 
176
- When `cloudflared` is available, the CLI starts a [Cloudflare Quick Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/) by default so your vault is accessible from the internet. Since the editor uses same-origin WebSocket routing (`/ws/:file`), the tunnel works for both HTTP and collaboration traffic.
238
+ CollabMD can optionally expose the session using a [Cloudflare Quick Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/). Since the editor uses same-origin WebSocket routing (`/ws/:file`), the tunnel works for both HTTP and collaboration traffic.
177
239
 
178
- If you are exposing the app through the tunnel, `collabmd --auth password` is the intended first-line protection. When you do not pass `--auth-password`, CollabMD generates a password for that host run and prints it in the terminal. Restarting the app rotates that password and the signed session secret.
240
+ If you are exposing the session publicly, `collabmd --auth password` is the intended first-line protection. When you do not pass `--auth-password`, CollabMD generates a password for that host run and prints it in the terminal. Restarting the app rotates that password and the signed session secret.
241
+
242
+ To share safely:
243
+
244
+ ```bash
245
+ collabmd ~/my-vault --auth password
246
+ ```
179
247
 
180
248
  `cloudflared` is optional. Install it only if you want public tunnel access:
181
249
 
@@ -196,11 +264,14 @@ TUNNEL_TARGET_URL=http://127.0.0.1:4000 collabmd
196
264
  CLOUDFLARED_EXTRA_ARGS="--loglevel info" collabmd
197
265
  ```
198
266
 
267
+ For the full runtime env var reference, see the `Environment variables` details block in the Development section below.
268
+
199
269
  ## Docker / Coolify deployment
200
270
 
271
+ Published image: `ghcr.io/andes90/collabmd:latest`
272
+
201
273
  ```bash
202
- docker build -t collabmd .
203
- docker run -p 1234:1234 -v /path/to/vault:/data collabmd
274
+ docker run -p 1234:1234 -v /path/to/vault:/data ghcr.io/andes90/collabmd:latest
204
275
  ```
205
276
 
206
277
  The container listens on `0.0.0.0:1234` and stores vault files at `/data`.
@@ -215,10 +286,10 @@ docker run \
215
286
  -e COLLABMD_GIT_SSH_PRIVATE_KEY_B64="$(base64 < ~/.ssh/id_ed25519 | tr -d '\n')" \
216
287
  -e COLLABMD_GIT_USER_NAME="CollabMD Bot" \
217
288
  -e COLLABMD_GIT_USER_EMAIL="bot@example.com" \
218
- collabmd
289
+ ghcr.io/andes90/collabmd:latest
219
290
  ```
220
291
 
221
- For a full local and Docker test walkthrough, including key generation and deploy-key setup, see [docs/private-git-deployment.md](./docs/private-git-deployment.md).
292
+ For a full local and Docker test walkthrough, including key generation and deploy-key setup, see [docs/private-git-deployment.md](https://github.com/andes90/collabmd/blob/master/docs/private-git-deployment.md).
222
293
 
223
294
  When `COLLABMD_GIT_REPO_URL` is set, CollabMD clones into `COLLABMD_VAULT_DIR` on first boot, then reuses that checkout on later starts. If the checkout already exists, startup validates that `origin` matches. Clean checkouts are fast-forwarded to the remote default branch; dirty checkouts are reused as-is and startup skips the sync.
224
295
 
@@ -237,7 +308,7 @@ docker run \
237
308
  -e COLLABMD_GIT_SSH_KNOWN_HOSTS_FILE=/run/secrets/collabmd_known_hosts \
238
309
  -e COLLABMD_GIT_USER_NAME="CollabMD Bot" \
239
310
  -e COLLABMD_GIT_USER_EMAIL="bot@example.com" \
240
- collabmd
311
+ ghcr.io/andes90/collabmd:latest
241
312
  ```
242
313
 
243
314
  ### Local docker-compose with a private PlantUML server
@@ -246,16 +317,16 @@ The included `docker-compose.yml` runs a prebuilt CollabMD image together with a
246
317
 
247
318
  ```bash
248
319
  mkdir -p data/vault
249
- docker build -t collabmd:local .
250
320
  docker compose up
251
321
  ```
252
322
 
253
323
  Open `http://localhost:1234`.
254
324
 
255
- By default, compose uses `COLLABMD_IMAGE=collabmd:local`. To run the published GitHub Container Registry image instead:
325
+ By default, compose uses `COLLABMD_IMAGE=ghcr.io/andes90/collabmd:latest`. If you want to test a local image while developing instead:
256
326
 
257
327
  ```bash
258
- COLLABMD_IMAGE=ghcr.io/<owner>/<repo>:latest docker compose up
328
+ docker build -t collabmd:local .
329
+ COLLABMD_IMAGE=collabmd:local docker compose up
259
330
  ```
260
331
 
261
332
  The PlantUML container is also published on loopback by default at `http://127.0.0.1:18080`, so the host-based CLI can reuse it with:
@@ -302,6 +373,16 @@ For a standard Coolify reverse-proxy setup, the default same-origin WebSocket ro
302
373
 
303
374
  Health check: `GET /health`
304
375
 
376
+ ## Troubleshooting
377
+
378
+ - `npx collabmd@latest` fails immediately: confirm you are running Node.js 24, which is the supported runtime for source and npm usage
379
+ - The app is reachable only from localhost: pass `--host 0.0.0.0` or set `HOST=0.0.0.0` when you intend to expose it on your network
380
+ - Port `1234` is already in use: pass `--port 3000` or set `PORT` to another free port
381
+ - Tunnel did not start: install `cloudflared`, or pass `--no-tunnel` to stay local-only
382
+ - `--local-plantuml` fails: make sure Docker is installed and running, or point `PLANTUML_SERVER_URL` at another PlantUML server
383
+ - Private git bootstrap fails on startup: verify `COLLABMD_GIT_REPO_URL` plus either `COLLABMD_GIT_SSH_PRIVATE_KEY_FILE` or `COLLABMD_GIT_SSH_PRIVATE_KEY_B64`
384
+ - WSL2 path issues: run CollabMD against a directory inside your Linux filesystem when possible rather than a mounted Windows path
385
+
305
386
  ## Development
306
387
 
307
388
  Install dependencies:
@@ -420,6 +501,7 @@ scripts/
420
501
  | `HTTP_HEADERS_TIMEOUT_MS` | Header read timeout | `60000` |
421
502
  | `HTTP_REQUEST_TIMEOUT_MS` | Request timeout | `30000` |
422
503
  | `WS_HEARTBEAT_INTERVAL_MS` | Heartbeat interval for evicting dead clients | `30000` |
504
+ | `WS_ROOM_IDLE_GRACE_MS` | Delay before closing empty collaboration rooms to disk | `15000` |
423
505
  | `WS_MAX_BUFFERED_AMOUNT_BYTES` | Max outbound buffer per WebSocket | `16777216` |
424
506
  | `WS_MAX_PAYLOAD_BYTES` | Max inbound WebSocket frame | `16777216` |
425
507
  | `CLOUDFLARED_BIN` | `cloudflared` binary path | `cloudflared` |
@@ -445,7 +527,7 @@ cp .env.example .env
445
527
  - `.obsidian`, `.git`, `.trash`, and `node_modules` directories are ignored.
446
528
  - Only `.md`, `.markdown`, and `.mdx` files are indexed.
447
529
  - PlantUML preview rendering is server-side and uses `PLANTUML_SERVER_URL`; point it at a self-hosted renderer if you do not want to use the public PlantUML service.
448
- - `docker compose up --build` uses the included local PlantUML service and avoids the public renderer by default. The initial git clone may also require a longer health-check grace period than a purely local vault.
530
+ - `docker compose up` uses the included local PlantUML service and avoids the public renderer by default. The initial git clone may also require a longer health-check grace period than a purely local vault.
449
531
  - `collabmd --local-plantuml` and `npm run start:local-plantuml` will start the local PlantUML compose service first, then run CollabMD against `http://127.0.0.1:${PLANTUML_HOST_PORT:-18080}`.
450
532
 
451
533
  ## License
@@ -1,6 +1,6 @@
1
1
  services:
2
2
  collabmd:
3
- image: ${COLLABMD_IMAGE:-collabmd:local}
3
+ image: ${COLLABMD_IMAGE:-ghcr.io/andes90/collabmd:latest}
4
4
  depends_on:
5
5
  - plantuml
6
6
  environment:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "collabmd",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "type": "module",
5
5
  "description": "Collaborative markdown vault — like Obsidian, but online. Serve any directory of markdown files for realtime collaborative editing.",
6
6
  "repository": {