@cuongtran001/kanna 0.52.0 → 0.54.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/README.md CHANGED
@@ -370,10 +370,26 @@ The update mechanism is abstracted behind `UpdateChecker` + `UpdateReloader` int
370
370
 
371
371
  | `KANNA_RELOADER` | Check | Reload | Notes |
372
372
  |---|---|---|---|
373
- | unset / `supervisor` | npm registry for `@cuongtran001/kanna` | `bun install -g @cuongtran001/kanna@latest`, exit 76, supervisor respawns | Default. End-user path for `bunx kanna`. |
373
+ | unset / `supervisor` | npm registry for `@cuongtran001/kanna` | `<pm> install -g @cuongtran001/kanna@latest`, exit 76, supervisor respawns | Default. End-user path. `<pm>` auto-detected: `bun`/`npm`/`pnpm`/`yarn`. Override via `KANNA_UPDATE_COMMAND`. |
374
374
  | `pm2` | `git fetch` + `HEAD` vs `origin/main` | `git pull --ff-only` → cond. `bun install` → `bun run build` → `pm2 reload` | Dev/self-host path. Requires `KANNA_REPO_DIR`. |
375
375
 
376
- To add another reload mechanism (e.g., docker, systemd), implement the two interfaces and branch inside `createUpdateStrategy`; no changes to `UpdateManager`, `server.ts`, or any client code are needed.
376
+ **Host-agnostic supervisor mode.** When `KANNA_RELOADER` is unset (default), the in-app Update button works under any process host (pm2, systemd, docker, screen, plain shell) — the internal supervisor catches the child's exit-76 and respawns. The package manager used to install the new version is auto-detected from the running binary path:
377
+
378
+ - `~/.bun/bin/kanna` → `bun install -g`
379
+ - `~/.local/share/pnpm/kanna` (or any `pnpm/` path) → `pnpm add -g`
380
+ - `~/.yarn/bin/kanna` (or any `.yarn/` path) → `yarn global add`
381
+ - anything else (e.g. `/usr/local/bin/kanna`, `~/.npm-global/bin/kanna`) → `npm install -g`
382
+
383
+ If the detected manager is not on `PATH`, kanna falls back through `bun → npm → pnpm → yarn`. To override the install command entirely — useful for custom installers, monorepo wrappers, docker pulls, ansible, etc. — set `KANNA_UPDATE_COMMAND`. Placeholders `{package}` and `{version}` are substituted; the result is executed via `sh -c`.
384
+
385
+ ```bash
386
+ # Force npm regardless of detection
387
+ KANNA_UPDATE_COMMAND="npm install -g {package}@{version}" pm2 start kanna
388
+ # Custom: chain pre-install hook
389
+ KANNA_UPDATE_COMMAND="my-deploy-hook && npm install -g {package}@{version}" kanna
390
+ ```
391
+
392
+ To add another reload mechanism (e.g., docker, systemd) at the strategy layer, implement `UpdateChecker` + `UpdateReloader` and branch inside `createUpdateStrategy`; no changes to `UpdateManager`, `server.ts`, or any client code are needed.
377
393
 
378
394
  ## Star History
379
395