@sealant/mend 0.21.1 → 0.23.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.
Files changed (80) hide show
  1. package/README.md +133 -6
  2. package/dist/chunk-YPM6TYQR.js +27888 -0
  3. package/dist/dashboard-LR5LHV7O.js +2951 -0
  4. package/dist/main.js +6917 -2580
  5. package/man/mend-accounts.1 +1 -1
  6. package/man/mend-adopt.1 +4 -4
  7. package/man/mend-attach.1 +1 -1
  8. package/man/mend-codex.1 +1 -1
  9. package/man/mend-completions.1 +1 -1
  10. package/man/mend-connect.1 +1 -1
  11. package/man/mend-continue.1 +1 -1
  12. package/man/mend-doctor.1 +1 -1
  13. package/man/mend-dotfiles-sync.1 +1 -1
  14. package/man/mend-dotfiles.1 +1 -1
  15. package/man/mend-env-cluster.1 +1 -1
  16. package/man/mend-env-load.1 +1 -1
  17. package/man/mend-env-show.1 +1 -1
  18. package/man/mend-help.1 +1 -1
  19. package/man/mend-keys-init.1 +1 -1
  20. package/man/mend-keys-mode.1 +1 -1
  21. package/man/mend-keys-share.1 +1 -1
  22. package/man/mend-keys-show.1 +1 -1
  23. package/man/mend-login.1 +1 -1
  24. package/man/mend-logout.1 +1 -1
  25. package/man/mend-man.1 +1 -1
  26. package/man/mend-pair.1 +1 -1
  27. package/man/mend-projects.1 +1 -1
  28. package/man/mend-refresh.1 +1 -1
  29. package/man/mend-rejoin.1 +1 -1
  30. package/man/mend-resume.1 +1 -1
  31. package/man/mend-run.1 +1 -1
  32. package/man/mend-server-logs.1 +15 -0
  33. package/man/mend-server-restart.1 +15 -0
  34. package/man/mend-server-setup.1 +64 -0
  35. package/man/mend-server-start.1 +15 -0
  36. package/man/mend-server-status.1 +11 -0
  37. package/man/mend-server-stop.1 +11 -0
  38. package/man/mend-server-upgrade.1 +30 -0
  39. package/man/mend-server.1 +11 -0
  40. package/man/mend-service-add.1 +1 -1
  41. package/man/mend-service-connect.1 +1 -1
  42. package/man/mend-service-init.1 +1 -1
  43. package/man/mend-service-list.1 +1 -1
  44. package/man/mend-service-logs.1 +1 -1
  45. package/man/mend-service-restart.1 +1 -1
  46. package/man/mend-service-run.1 +1 -1
  47. package/man/mend-service-stop.1 +1 -1
  48. package/man/mend-sessions.1 +1 -1
  49. package/man/mend-shell.1 +1 -1
  50. package/man/mend-skills-push.1 +1 -1
  51. package/man/mend-skills.1 +1 -1
  52. package/man/mend-ssh-setup.1 +6 -3
  53. package/man/mend-ssh.1 +1 -1
  54. package/man/mend-stop.1 +1 -1
  55. package/man/mend-ui.1 +1 -1
  56. package/man/mend-version.1 +1 -1
  57. package/man/mend-worktrees.1 +1 -1
  58. package/man/mend.1 +26 -2
  59. package/package.json +6 -2
  60. package/dist/agent-share.js +0 -150
  61. package/dist/clipboard.js +0 -73
  62. package/dist/dashboard-model.js +0 -308
  63. package/dist/dashboard.js +0 -1200
  64. package/dist/doctor.js +0 -233
  65. package/dist/dotfiles.js +0 -90
  66. package/dist/env.js +0 -17
  67. package/dist/help.js +0 -839
  68. package/dist/login.js +0 -240
  69. package/dist/pair.js +0 -83
  70. package/dist/review-model.js +0 -212
  71. package/dist/review-workflow.js +0 -8
  72. package/dist/review.js +0 -690
  73. package/dist/service-init.js +0 -227
  74. package/dist/shared.js +0 -338
  75. package/dist/skills.js +0 -134
  76. package/dist/ssh-setup.js +0 -181
  77. package/dist/terminal.js +0 -8
  78. package/dist/tui-theme.js +0 -41
  79. package/dist/version.js +0 -48
  80. package/dist/workbench-events.js +0 -72
package/README.md CHANGED
@@ -17,6 +17,48 @@ diffs, reveal whitespace, select line ranges, add line or whole-change comments,
17
17
  evidence, and draft a follow-up for the same session. Press `y` to deliver a pending follow-up and
18
18
  relaunch that session, or `o` to continue the review in the web app.
19
19
 
20
+ ## Local server
21
+
22
+ On a machine with a local Docker daemon and Compose v2 (Linux is verified; macOS with Docker Desktop
23
+ or OrbStack is still being validated, see
24
+ [docs/MACOS-VALIDATION.md](https://github.com/sealant-sh/Mend/blob/main/docs/MACOS-VALIDATION.md)):
25
+
26
+ ```sh
27
+ mend server setup
28
+ mend server status
29
+ mend server logs --tail 100
30
+ mend server stop
31
+ mend server start
32
+ mend server restart
33
+ ```
34
+
35
+ Setup preserves the existing server pin even when this CLI is newer. To change the pin, use
36
+ `mend server upgrade --version TARGET`; `latest` is accepted only when explicitly requested. Upgrade
37
+ checks release assets and image labels before stopping app writers, then makes a private Postgres
38
+ database backup before target startup. Once migrations may have started, failures retain the target
39
+ pin rather than automatically downgrading or restoring the database.
40
+
41
+ For local release assets and preloaded images:
42
+
43
+ ```sh
44
+ mend server setup --version 0.23.0 --assets-dir ./release-0.23.0 --offline --registry-port 5501
45
+ mend server upgrade --version 0.24.0 --assets-dir ./release-0.24.0 --offline
46
+ ```
47
+
48
+ Each asset directory must contain `compose.v1.yaml` and `postgres-init.sh`. Mend copies them into an
49
+ immutable private generation; the source directory is not needed afterward. Preload official
50
+ `postgres:17-alpine` and canonical `ghcr.io/sealant-sh/mend:VERSION`. Image labels and health must
51
+ report that exact version. `--offline` forbids GitHub requests and release-image pulls.
52
+ Start/restart always reuse local release images and retained assets. Startup still verifies the
53
+ loopback registry by importing, pushing, removing and pulling its own tiny probe image. The registry
54
+ defaults to port 5000; choose a free `--registry-port` when another registry, such as Sealant's,
55
+ already uses it.
56
+
57
+ Stop/restart/upgrade interrupt connections. Workspace containers and data remain, but active work
58
+ may lose connectivity and need reconnection. No volumes are deleted. Status/logs never start an
59
+ installation or change its configuration. See [SERVER-RUNTIME.md](SERVER-RUNTIME.md) for the backup
60
+ layout, lock recovery, and migration-failure procedure.
61
+
20
62
  ## Getting started
21
63
 
22
64
  Once per machine, in this order:
@@ -39,11 +81,11 @@ mend pair [--url <base url>]
39
81
  ```
40
82
 
41
83
  Asks the server for a pairing code and prints it three ways: a QR of the `mend://pair` deep link,
42
- the code grouped as `ABCD-EFGH`, and the base URL the device should reach — the machine's tailnet
43
- address when it has one, otherwise a LAN address (`--url` overrides the choice). Scan it in the Mend
44
- app, or type the URL and the code in by hand. The code is single use and expires in 10 minutes; the
45
- device's own token is minted when it claims the code, and can be revoked from the Mend app later.
46
- The device names itself when it claims the code.
84
+ the code grouped as `ABCD-EFGH`, and the base URL the device should reach, chosen from the origins
85
+ configured on the server (`--url` selects one of them; it cannot add an address the server does not
86
+ know). Scan it in the Mend app, or type the URL and the code in by hand. The code is single use and
87
+ expires in 10 minutes; the device's own token is minted when it claims the code, and can be revoked
88
+ from the Mend app later. The device names itself when it claims the code.
47
89
 
48
90
  ### mend doctor
49
91
 
@@ -72,7 +114,8 @@ It exits 1 when a `✗` is printed, so a setup script can gate on it. No request
72
114
  ## Commands
73
115
 
74
116
  ```
75
- mend adopt [source] [--name <name>] adopt a repository into the store (default: cwd)
117
+ mend adopt [git-url] [--name <name>] clone a network Git repository into the store
118
+ (default: the current checkout's origin URL)
76
119
  mend codex|claude|opencode new session worktree + launch the harness in it
77
120
  mend run -- <command...> same, with an arbitrary command
78
121
  mend attach <session-id-prefix> reattach this terminal to a running session
@@ -87,6 +130,11 @@ mend skills [--project [p]] your skill library on the server (or a pro
87
130
  mend skills push [--project [p]] [--prune] [--dir <path>]
88
131
  upload ~/.agents/skills bundles; sessions receive
89
132
  them at launch (--prune removes what's gone)
133
+ mend keys init|show|mode|share your Mend git key, default access mode, agent bridge
134
+ mend ssh [setup] workspace SSH status; register a key + Host block
135
+ mend server <command> this machine's Docker server: setup, status, logs,
136
+ start, stop, restart, upgrade
137
+ mend version this CLI's version, and the server's when it answers
90
138
  ```
91
139
 
92
140
  ## Signing in
@@ -108,6 +156,70 @@ printed URL on any signed-in device instead.
108
156
  The token is stored 0600 in the CLI config below; every command uses it until `mend logout`. On a
109
157
  dev instance with `MEND_STATIC_TOKEN` set, `MEND_TOKEN=<that value>` also works.
110
158
 
159
+ ## Workspace SSH
160
+
161
+ ```sh
162
+ mend ssh # inspect config and this client's key registration
163
+ mend ssh setup # register a key and reconcile this server's Host block
164
+ mend ssh setup --key ./my-key # explicitly select private key or its .pub file
165
+ mend ssh setup --host mini.tailnet.ts.net
166
+ ```
167
+
168
+ Setup puts the managed block before wildcard defaults and restores all-host scope before your
169
+ original configuration. It preserves other servers and hand-written Host/Match rules. If moving an
170
+ older block would change the scope of trailing directives, it refuses the write; put those
171
+ directives in an explicit Host or Match block and rerun setup.
172
+
173
+ Relative `--key` paths resolve against the invoking directory; `~/` resolves against your home.
174
+ Identity paths with spaces, quotes, backslashes and literal `%` are escaped for OpenSSH. Control
175
+ characters, `~user` paths and `${…}` expansions are rejected. Mend reuses a selected key, never
176
+ silently substitutes another identity when it disappears. A readable, unencrypted private key must
177
+ match the public half; otherwise the exact public identity must be available in an unlocked
178
+ ssh-agent. Unlock encrypted keys yourself with `ssh-add` before setup. Checks are noninteractive and
179
+ time-bounded. First setup can pin an agent public key or generate a dedicated key under the Mend
180
+ config directory. Later setup preserves private keys.
181
+
182
+ Status and setup report config and client-key registration, not a successful SSH connection or
183
+ verified host trust. The public Sealant SDK's gateway info supplies host, port and username prefix,
184
+ not a host-key fingerprint. Mend cannot authenticate a rotated host key from that metadata.
185
+
186
+ ### Gateway host-key rotation
187
+
188
+ Mend uses a stable per-server `HostKeyAlias`. OpenSSH's `accept-new` policy accepts an unknown key
189
+ on first connection, but refuses a changed key. Rerunning setup does not replace or remove any
190
+ `known_hosts` entry. Treat a mismatch as a possible interception until verified.
191
+
192
+ 1. On the trusted server, through its console or a separately trusted administrative connection,
193
+ find the SSH host-key file configured for the **gateway container**, not a session workspace.
194
+ Read its SHA-256 fingerprint there. For Docker, substitute the actual container and its
195
+ configured host-key file in this command:
196
+
197
+ ```sh
198
+ docker exec GATEWAY_CONTAINER ssh-keygen -lf HOST_KEY_FILE -E sha256
199
+ ```
200
+
201
+ Use the host key or its `.pub` file; do not copy or print private key contents. Keep the gateway
202
+ host-key storage persistent across ordinary restarts. A genuine rotation should be deliberate.
203
+
204
+ 2. Compare that fingerprint out-of-band with the gateway fingerprint in the client's SSH warning. If
205
+ they differ, or you cannot access the trusted server, stop. `ssh-keyscan` alone is not
206
+ verification, and an API response containing only host/port does not establish host trust.
207
+ 3. Only after the fingerprints match, locate this server's exact `HostKeyAlias` and
208
+ `UserKnownHostsFile` with `ssh -G YOUR_MEND_ALIAS`. Back up that known-hosts file. Remove only
209
+ the exact alias entry from that file, not the hostname, other server aliases, or the whole file:
210
+
211
+ ```sh
212
+ ssh-keygen -F 'EXACT_HOST_KEY_ALIAS' -f ~/.ssh/known_hosts
213
+ ssh-keygen -R 'EXACT_HOST_KEY_ALIAS' -f ~/.ssh/known_hosts
214
+ ```
215
+
216
+ Replace the alias and file path with the values you inspected. These commands also find and
217
+ remove hashed entries for that exact alias.
218
+
219
+ 4. Reconnect explicitly with `ssh -o StrictHostKeyChecking=ask USER@YOUR_MEND_ALIAS`. Compare the
220
+ prompt's fingerprint with the trusted-server fingerprint again before accepting. A different
221
+ fingerprint is a reason to stop, not to bypass host-key checking.
222
+
111
223
  ## Configuration
112
224
 
113
225
  | Source | What |
@@ -125,6 +237,21 @@ whether it was started from the `mend` dashboard or a one-shot CLI command. Mend
125
237
  foreground-process hint rather than claiming lifecycle authority, so Herdr continues to derive
126
238
  working, idle, and blocked from its native agent screen rules.
127
239
 
240
+ ## Building and checking the npm package
241
+
242
+ `pnpm --filter @sealant/mend typecheck` uses tsgo without emission.
243
+ `pnpm --filter @sealant/mend build` bundles the CLI and its private workspace dependencies with
244
+ esbuild, follows transitive imports, and generates the man pages. Split chunks stay directly in
245
+ `dist/` so package-relative version reads work. Only declared public runtime dependencies remain
246
+ external. The dashboard still loads OpenTUI lazily; ordinary commands do not require its native
247
+ runtime. Source files remain runnable by the existing tests.
248
+
249
+ `pnpm --filter @sealant/mend test:package` packs the CLI and uses npm to install the tarball into a
250
+ fresh directory outside the checkout. It needs registry access. The smoke test checks the published
251
+ files and runs server-independent commands with OpenTUI temporarily removed. Set
252
+ `MEND_KEEP_PACKAGE_TEST=1` to retain the printed directory and installed package for inspection.
253
+ Neither installation nor the build installs or starts a Mend server.
254
+
128
255
  ## How it works
129
256
 
130
257
  Every session runs in its own git worktree over the adopted repository, inside a recorded workspace.