@pinchpass/cli 1.0.4 → 1.0.6
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/dist/index.js +47 -45
- package/openclaw.plugin.json +1 -6
- package/package.json +6 -12
- package/scripts/install-binary.js +58 -0
package/dist/index.js
CHANGED
|
@@ -1,49 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const FRESH_WATCHDOG = {
|
|
4
|
-
...CLI_FRESH_WATCHDOG_DEFAULTS,
|
|
5
|
-
timeout: 3_600_000,
|
|
6
|
-
maxMissedHeartbeats: 120,
|
|
7
|
-
};
|
|
8
|
-
const RESUME_WATCHDOG = {
|
|
9
|
-
...CLI_RESUME_WATCHDOG_DEFAULTS,
|
|
10
|
-
timeout: 3_600_000,
|
|
11
|
-
maxMissedHeartbeats: 120,
|
|
12
|
-
};
|
|
13
|
-
function buildPinchpassBackend() {
|
|
1
|
+
import { tool } from "@opencode-ai/plugin/tool";
|
|
2
|
+
export default async ({ $ }) => {
|
|
14
3
|
return {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
4
|
+
tool: {
|
|
5
|
+
request_secret: tool({
|
|
6
|
+
description: "Generate a one-time E2E-encrypted secret request link. " +
|
|
7
|
+
"Use when you need to collect sensitive values (API keys, tokens, passwords) from the user. " +
|
|
8
|
+
"The tool starts a local server, prints a link, and blocks until the user submits or the TTL expires. " +
|
|
9
|
+
"On success the secret is saved to .env and the tool returns the result.",
|
|
10
|
+
args: {
|
|
11
|
+
names: tool.schema
|
|
12
|
+
.array(tool.schema.string())
|
|
13
|
+
.min(1)
|
|
14
|
+
.describe("Secret name(s) to collect, e.g. ['GEMINI_API_KEY']"),
|
|
15
|
+
tunnel: tool.schema
|
|
16
|
+
.boolean()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe("Create a public URL via bore.pub tunnel (default: false)"),
|
|
19
|
+
note: tool.schema
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Description shown on the form to help the user"),
|
|
23
|
+
ttl: tool.schema
|
|
24
|
+
.number()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("Minutes until the link expires (default: 30)"),
|
|
37
27
|
},
|
|
38
|
-
|
|
28
|
+
async execute(args) {
|
|
29
|
+
const pieces = ["pinchpass", "request", ...args.names, "-json"];
|
|
30
|
+
if (args.tunnel)
|
|
31
|
+
pieces.push("-tunnel");
|
|
32
|
+
if (args.note)
|
|
33
|
+
pieces.push("-note", args.note);
|
|
34
|
+
if (args.ttl)
|
|
35
|
+
pieces.push("-ttl", String(args.ttl));
|
|
36
|
+
try {
|
|
37
|
+
const result = await $.raw(pieces);
|
|
38
|
+
return result.stdout || result.text || String(result);
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
42
|
+
const stderr = err && typeof err === "object" && "stderr" in err
|
|
43
|
+
? err.stderr
|
|
44
|
+
: "";
|
|
45
|
+
return `Failed: ${msg}${stderr ? "\n" + stderr : ""}`;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
39
49
|
},
|
|
40
50
|
};
|
|
41
|
-
}
|
|
42
|
-
export default definePluginEntry({
|
|
43
|
-
id: "pinchpass",
|
|
44
|
-
name: "PinchPass",
|
|
45
|
-
description: "One-time E2E-encrypted secret request links",
|
|
46
|
-
register(api) {
|
|
47
|
-
api.registerCliBackend(buildPinchpassBackend());
|
|
48
|
-
},
|
|
49
|
-
});
|
|
51
|
+
};
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "pinchpass",
|
|
3
3
|
"name": "PinchPass",
|
|
4
|
-
"description": "
|
|
5
|
-
"cliBackends": ["pinchpass"],
|
|
6
|
-
"setup": {
|
|
7
|
-
"cliBackends": ["pinchpass"],
|
|
8
|
-
"requiresRuntime": false
|
|
9
|
-
},
|
|
4
|
+
"description": "Generate one-time E2E-encrypted secret request links",
|
|
10
5
|
"activation": {
|
|
11
6
|
"onStartup": false
|
|
12
7
|
},
|
package/package.json
CHANGED
|
@@ -1,31 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinchpass/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "One-time E2E-encrypted secret request links for OpenClaw agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
9
|
"SKILL.md",
|
|
10
|
-
"openclaw.plugin.json"
|
|
10
|
+
"openclaw.plugin.json",
|
|
11
|
+
"scripts"
|
|
11
12
|
],
|
|
12
13
|
"openclaw": {
|
|
13
|
-
"extensions": ["./dist/index.js"]
|
|
14
|
-
"compat": {
|
|
15
|
-
"pluginApi": ">=2026.3.24-beta.2",
|
|
16
|
-
"minGatewayVersion": "2026.3.24-beta.2"
|
|
17
|
-
},
|
|
18
|
-
"build": {
|
|
19
|
-
"openclawVersion": "2026.3.24-beta.2",
|
|
20
|
-
"pluginSdkVersion": "2026.3.24-beta.2"
|
|
21
|
-
}
|
|
14
|
+
"extensions": ["./dist/index.js"]
|
|
22
15
|
},
|
|
23
16
|
"scripts": {
|
|
24
17
|
"build": "tsc",
|
|
18
|
+
"postinstall": "node scripts/install-binary.js",
|
|
25
19
|
"prepublishOnly": "npm run build"
|
|
26
20
|
},
|
|
27
21
|
"dependencies": {
|
|
28
|
-
"
|
|
22
|
+
"@opencode-ai/plugin": "^1.16.2"
|
|
29
23
|
},
|
|
30
24
|
"devDependencies": {
|
|
31
25
|
"typescript": "^5.9.0"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execSync } from "child_process";
|
|
4
|
+
import { existsSync, mkdirSync, writeFileSync, chmodSync } from "fs";
|
|
5
|
+
import { homedir, platform } from "os";
|
|
6
|
+
|
|
7
|
+
const VERSION = "latest";
|
|
8
|
+
const REPO = "rubybear-lgtm/PinchPass";
|
|
9
|
+
|
|
10
|
+
function detectBinary() {
|
|
11
|
+
const arch = process.arch === "arm64" ? "arm64" : "amd64";
|
|
12
|
+
const osMap = {
|
|
13
|
+
darwin: "darwin",
|
|
14
|
+
linux: "linux",
|
|
15
|
+
win32: "windows",
|
|
16
|
+
};
|
|
17
|
+
const plat = osMap[process.platform];
|
|
18
|
+
if (!plat) throw new Error(`Unsupported platform: ${process.platform}`);
|
|
19
|
+
return { name: `pinchpass-${plat}-${arch}`, plat, arch };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function install() {
|
|
23
|
+
const { name } = detectBinary();
|
|
24
|
+
const installDir = `${homedir()}/.openclaw/bin`;
|
|
25
|
+
const dest = `${installDir}/pinchpass`;
|
|
26
|
+
|
|
27
|
+
if (existsSync(dest)) {
|
|
28
|
+
console.log(`pinchpass already installed at ${dest}`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const url =
|
|
33
|
+
VERSION === "latest"
|
|
34
|
+
? `https://github.com/${REPO}/releases/latest/download/${name}`
|
|
35
|
+
: `https://github.com/${REPO}/releases/download/v${VERSION}/${name}`;
|
|
36
|
+
|
|
37
|
+
console.log(`Downloading pinchpass from ${url}...`);
|
|
38
|
+
|
|
39
|
+
mkdirSync(installDir, { recursive: true });
|
|
40
|
+
|
|
41
|
+
if (process.platform === "win32") {
|
|
42
|
+
execSync(`curl -sL "${url}" -o "${dest}.exe"`, { stdio: "inherit" });
|
|
43
|
+
} else {
|
|
44
|
+
execSync(`curl -sL "${url}" -o "${dest}"`, { stdio: "inherit" });
|
|
45
|
+
chmodSync(dest, 0o755);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
console.log(`Installed pinchpass to ${dest}`);
|
|
49
|
+
console.log(`Add ${installDir} to your PATH if not already present.`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
install().catch((err) => {
|
|
53
|
+
console.error(`Failed to install pinchpass binary: ${err.message}`);
|
|
54
|
+
console.log(
|
|
55
|
+
`To build from source: cd pinchpass-plugin && go build -o pinchpass .`
|
|
56
|
+
);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
});
|