@pinchpass/cli 1.0.0 → 1.0.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/dist/index.d.ts +3 -1
- package/dist/index.js +11 -12
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { tool } from "@opencode-ai/plugin/tool";
|
|
2
|
-
|
|
3
|
-
export default async () => {
|
|
2
|
+
export default async ({ $ }) => {
|
|
4
3
|
return {
|
|
5
4
|
tool: {
|
|
6
5
|
request_secret: tool({
|
|
@@ -27,23 +26,23 @@ export default async () => {
|
|
|
27
26
|
.describe("Minutes until the link expires (default: 30)"),
|
|
28
27
|
},
|
|
29
28
|
async execute(args) {
|
|
30
|
-
const
|
|
29
|
+
const pieces = ["pinchpass", "request", ...args.names, "-json"];
|
|
31
30
|
if (args.tunnel)
|
|
32
|
-
|
|
31
|
+
pieces.push("-tunnel");
|
|
33
32
|
if (args.note)
|
|
34
|
-
|
|
33
|
+
pieces.push("-note", args.note);
|
|
35
34
|
if (args.ttl)
|
|
36
|
-
|
|
35
|
+
pieces.push("-ttl", String(args.ttl));
|
|
37
36
|
try {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
timeout: (args.ttl ?? 30) * 60 * 1000,
|
|
41
|
-
});
|
|
42
|
-
return stdout;
|
|
37
|
+
const result = await $.raw(pieces);
|
|
38
|
+
return result.stdout || result.text || String(result);
|
|
43
39
|
}
|
|
44
40
|
catch (err) {
|
|
45
41
|
const msg = err instanceof Error ? err.message : String(err);
|
|
46
|
-
|
|
42
|
+
const stderr = err && typeof err === "object" && "stderr" in err
|
|
43
|
+
? err.stderr
|
|
44
|
+
: "";
|
|
45
|
+
return `Failed: ${msg}${stderr ? "\n" + stderr : ""}`;
|
|
47
46
|
}
|
|
48
47
|
},
|
|
49
48
|
}),
|