@pinchpass/cli 1.2.0 → 1.2.1
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 +11 -5
- package/bin/pinchpass.js +71 -0
- package/package.json +5 -1
- package/skills/pinchpass/SKILL.md +6 -1
package/README.md
CHANGED
|
@@ -11,18 +11,24 @@ in the URL fragment.
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
npm i -g @pinchpass/cli
|
|
14
|
+
npm i -g @pinchpass/cli # provides the `pinchpass` command
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npx @pinchpass/cli request API_KEY # no install; fetches the binary on first run
|
|
15
19
|
```
|
|
16
20
|
|
|
17
21
|
```sh
|
|
18
22
|
brew install --cask rubybear-lgtm/tap/pinchpass
|
|
19
23
|
```
|
|
20
24
|
|
|
21
|
-
The npm
|
|
22
|
-
|
|
25
|
+
The npm package installs this package's `bin/pinchpass.js`, which resolves the
|
|
26
|
+
platform binary and hands off to it. The postinstall downloads that binary to
|
|
27
|
+
`~/.local/bin`, verifying it against the release's `checksums.txt`, and is
|
|
28
|
+
version-aware: when the binary it finds (on `PATH`, or in `~/.local/bin`,
|
|
23
29
|
`~/.openclaw/bin`, `~/.pi/bin`) does not report the package's version, it
|
|
24
|
-
downloads the matching release asset and replaces it.
|
|
25
|
-
|
|
30
|
+
downloads the matching release asset and replaces it. Set
|
|
31
|
+
`PINCHPASS_SKIP_DOWNLOAD=1` to skip the download.
|
|
26
32
|
|
|
27
33
|
## Updating
|
|
28
34
|
|
package/bin/pinchpass.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `pinchpass` CLI entry point.
|
|
4
|
+
*
|
|
5
|
+
* npm installs this file as the package's `bin`, so `npx @pinchpass/cli` and a
|
|
6
|
+
* global install behave like a normal npm CLI. It resolves the platform binary
|
|
7
|
+
* (downloading it on first use) and hands off to it, forwarding stdio, signals,
|
|
8
|
+
* and the exit code.
|
|
9
|
+
*
|
|
10
|
+
* It deliberately does not re-check the binary version on every run: keeping
|
|
11
|
+
* updates in `npm update -g` / `brew upgrade` keeps `pinchpass request` fast
|
|
12
|
+
* and predictable.
|
|
13
|
+
*/
|
|
14
|
+
import { spawn } from "node:child_process";
|
|
15
|
+
|
|
16
|
+
let findBinary;
|
|
17
|
+
let install;
|
|
18
|
+
try {
|
|
19
|
+
const [binaryMod, installerMod] = await Promise.all([
|
|
20
|
+
import("../dist/binary.js"),
|
|
21
|
+
import("../scripts/install-binary.js"),
|
|
22
|
+
]);
|
|
23
|
+
findBinary = binaryMod.findBinary;
|
|
24
|
+
install = installerMod.install;
|
|
25
|
+
} catch (err) {
|
|
26
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
27
|
+
process.stderr.write(`pinchpass: package is not built (${message})\n`);
|
|
28
|
+
process.stderr.write("pinchpass: run `npm run build` in the package directory.\n");
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function resolveBinary() {
|
|
33
|
+
const existing = findBinary();
|
|
34
|
+
if (existing) return existing;
|
|
35
|
+
|
|
36
|
+
process.stderr.write("pinchpass: downloading the platform binary...\n");
|
|
37
|
+
await install({ log: (line) => process.stderr.write(`${line}\n`) });
|
|
38
|
+
return findBinary();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const binary = await resolveBinary();
|
|
42
|
+
if (!binary) {
|
|
43
|
+
process.stderr.write(
|
|
44
|
+
"pinchpass: could not find or install the binary.\n" +
|
|
45
|
+
"pinchpass: install it with `npm i -g @pinchpass/cli` or " +
|
|
46
|
+
"`go install github.com/rubybear-lgtm/pinchpass@latest`.\n",
|
|
47
|
+
);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const child = spawn(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
52
|
+
|
|
53
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
54
|
+
process.on(signal, () => {
|
|
55
|
+
try {
|
|
56
|
+
child.kill(signal);
|
|
57
|
+
} catch {
|
|
58
|
+
// already gone
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
child.on("error", (err) => {
|
|
64
|
+
process.stderr.write(`pinchpass: failed to run ${binary}: ${err.message}\n`);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
child.on("exit", (code, signal) => {
|
|
69
|
+
if (signal) process.kill(process.pid, signal);
|
|
70
|
+
else process.exit(code ?? 1);
|
|
71
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinchpass/cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "One-time E2E-encrypted secret request links — native for Pi and OpenClaw agents",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,8 +16,12 @@
|
|
|
16
16
|
],
|
|
17
17
|
"type": "module",
|
|
18
18
|
"main": "./dist/index.js",
|
|
19
|
+
"bin": {
|
|
20
|
+
"pinchpass": "./bin/pinchpass.js"
|
|
21
|
+
},
|
|
19
22
|
"files": [
|
|
20
23
|
"dist",
|
|
24
|
+
"bin",
|
|
21
25
|
"skills",
|
|
22
26
|
"openclaw.plugin.json",
|
|
23
27
|
"scripts",
|
|
@@ -37,10 +37,15 @@ pi install npm:@pinchpass/cli
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
# Any agent (npm —
|
|
40
|
+
# Any agent (npm — provides the `pinchpass` command)
|
|
41
41
|
npm i -g @pinchpass/cli
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
```bash
|
|
45
|
+
# No install needed (npx fetches package and binary on first use)
|
|
46
|
+
npx @pinchpass/cli request API_KEY
|
|
47
|
+
```
|
|
48
|
+
|
|
44
49
|
```bash
|
|
45
50
|
# From source (requires Go 1.26+)
|
|
46
51
|
go install github.com/rubybear-lgtm/pinchpass@latest
|