sefy-cli 0.11.0 → 0.12.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 (3) hide show
  1. package/README.md +6 -2
  2. package/package.json +2 -2
  3. package/run.js +24 -1
package/README.md CHANGED
@@ -126,8 +126,12 @@ Every command, with its flags: **[the reference](https://lacodda.github.io/sefy/
126
126
  - **Transports, not lock-in.** `sefy sync` carries the vault through a
127
127
  `sefy-plugin-*` executable - github and sftp ship today - and folds what
128
128
  comes back in without a credential ever passing through the transport.
129
- - **Merge instead of overwrite.** Where two copies disagree about an item,
130
- both are kept rather than letting a timestamp pick a winner.
129
+ - **Every value keeps its past.** An edit keeps what it replaced; `sefy
130
+ history` shows how each version differs without printing a secret, and
131
+ `sefy restore` brings one back - whole, or one field.
132
+ - **Merge instead of overwrite.** Where two copies both changed an item, the
133
+ newer is current and the other waits in its history rather than being
134
+ dropped on a timestamp.
131
135
  - **A vault that is never a trap.** `export` writes plaintext JSON only after
132
136
  you say so explicitly.
133
137
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "sefy-cli",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "sefy": {
5
- "binary": "v0.11.0"
5
+ "binary": "v0.12.0"
6
6
  },
7
7
  "description": "An inconspicuous encrypted store for notes, credentials and files",
8
8
  "license": "MIT",
package/run.js CHANGED
@@ -2,12 +2,35 @@
2
2
  // Thin launcher: forwards everything to the sefy binary, downloading it on
3
3
  // first run when the postinstall script was skipped (npm v12 default).
4
4
  const fs = require("fs");
5
+ const os = require("os");
5
6
  const { spawnSync } = require("child_process");
6
7
  const { install, exePath } = require("./download");
7
8
 
9
+ // The keystrokes a terminal sends to every process on it, this launcher
10
+ // included. Left to the default, the launcher would die at once and hand the
11
+ // prompt back while sefy - or the command `sefy run` started - is still
12
+ // deciding what to do with the same keystroke. Listening keeps the launcher
13
+ // alive until the binary is done; the binary alone decides.
14
+ const KEYSTROKES =
15
+ process.platform === "win32" ? ["SIGINT", "SIGBREAK"] : ["SIGINT", "SIGQUIT"];
16
+
8
17
  function exec() {
18
+ const stayPut = () => {};
19
+ for (const signal of KEYSTROKES) process.on(signal, stayPut);
20
+
9
21
  const result = spawnSync(exePath, process.argv.slice(2), { stdio: "inherit" });
10
- process.exit(result.status === null ? 1 : result.status);
22
+ if (result.error) {
23
+ console.error(`sefy-cli: cannot start ${exePath}: ${result.error.message}`);
24
+ process.exit(1);
25
+ }
26
+ if (result.signal) {
27
+ // Ended by a signal: end the same way, so the shell reports it as it
28
+ // would for the binary run directly (130 after Ctrl+C), not as a plain 1.
29
+ for (const signal of KEYSTROKES) process.removeListener(signal, stayPut);
30
+ process.kill(process.pid, result.signal);
31
+ process.exit(128 + (os.constants.signals[result.signal] || 0));
32
+ }
33
+ process.exit(result.status);
11
34
  }
12
35
 
13
36
  if (fs.existsSync(exePath)) {