The CLI only touches Node builtins and libsodium-wrappers (no native addons like better-sqlite3, which the server needs but the CLI never imports) -- confirmed by checking its actual import graph, not assumed. That makes it a good candidate for a single-file esbuild bundle rather than requiring a full git checkout + npm install on every machine that needs to run `keep pull`. deploy-cli.sh bundles src/cli (~18kb) and ships it straight to a host over SSH -- HOST=user@vps ./deploy-cli.sh -- mirroring flit's deploy-daemon.sh ssh-cat-chmod pattern rather than inventing a new convention. No git, no npm install, no node_modules on the target at all, just the one file plus a `node` runtime already there from whatever else is deployed on that box. Caught a real bug while building this: --banner:js="#!/usr/bin/env node" duplicated the shebang esbuild already preserves from the source file automatically, landing it on line 2 instead of line 1 -- Node only special-cases a shebang on line 1, so the bundle threw a syntax error on every invocation until the redundant banner flag was removed. Verified the bundle for real, not just that it builds: ran `keep identity init` / `identity show` against it directly and confirmed a real Ed25519 keypair comes out the other end -- the specific thing worth checking given libsodium-wrappers needed a createRequire workaround for its own broken ESM packaging, and bundling could easily have broken that differently. Also documents both CLI-provisioning paths in INTEGRATION.md (scripts/install-cli.sh for a machine you're fine cloning onto, deploy-cli.sh for one you'd rather not) as a "getting keep onto a machine" prerequisite section, ahead of the existing deploy-pattern docs that all assume it's already there. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
31 lines
838 B
JSON
31 lines
838 B
JSON
{
|
|
"name": "keep",
|
|
"version": "0.1.0",
|
|
"license": "MIT",
|
|
"type": "module",
|
|
"bin": {
|
|
"keep": "./dist/cli/index.js"
|
|
},
|
|
"scripts": {
|
|
"dev:server": "tsx watch --env-file=.env src/server/index.ts",
|
|
"cli": "tsx src/cli/index.ts",
|
|
"build": "tsc",
|
|
"build:cli-bundle": "esbuild src/cli/index.ts --bundle --platform=node --format=esm --outfile=dist-bundle/keep --external:node:*",
|
|
"start": "node --env-file=.env dist/server/index.js"
|
|
},
|
|
"dependencies": {
|
|
"better-sqlite3": "^11.3.0",
|
|
"express": "^4.19.2",
|
|
"libsodium-wrappers": "^0.7.15"
|
|
},
|
|
"devDependencies": {
|
|
"@types/better-sqlite3": "^7.6.11",
|
|
"@types/express": "^4.17.21",
|
|
"@types/libsodium-wrappers": "^0.7.14",
|
|
"@types/node": "^22.0.0",
|
|
"esbuild": "^0.28.1",
|
|
"tsx": "^4.15.0",
|
|
"typescript": "^5.5.0"
|
|
}
|
|
}
|