@pushpalsdev/cli 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/README.md +36 -0
- package/bin/pushpals.cjs +76 -0
- package/dist/pushpals-cli.js +1249 -0
- package/package.json +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @pushpalsdev/cli
|
|
2
|
+
|
|
3
|
+
Terminal-first PushPals client that routes chat through `LocalBuddy -> RemoteBuddy`.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i -g @pushpalsdev/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
or:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bun install -g @pushpalsdev/cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Run
|
|
18
|
+
|
|
19
|
+
From a git repository that is attached to your running PushPals stack:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pushpals
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The CLI hard-fails if:
|
|
26
|
+
|
|
27
|
+
- current directory is not a git repository
|
|
28
|
+
- LocalBuddy is unavailable
|
|
29
|
+
- LocalBuddy is attached to a different repo root
|
|
30
|
+
- Bun runtime is not installed (for npm-installed entrypoint execution)
|
|
31
|
+
|
|
32
|
+
## No npm/Bun install
|
|
33
|
+
|
|
34
|
+
Download native binaries from GitHub Releases:
|
|
35
|
+
|
|
36
|
+
https://github.com/PushPalsDev/pushpals/releases
|
package/bin/pushpals.cjs
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { spawn, spawnSync } = require("node:child_process");
|
|
5
|
+
const { existsSync } = require("node:fs");
|
|
6
|
+
const { resolve } = require("node:path");
|
|
7
|
+
|
|
8
|
+
const bundledCliPath = resolve(__dirname, "..", "dist", "pushpals-cli.js");
|
|
9
|
+
const releaseUrl = "https://github.com/PushPalsDev/pushpals/releases";
|
|
10
|
+
|
|
11
|
+
function fail(lines) {
|
|
12
|
+
for (const line of lines) {
|
|
13
|
+
process.stderr.write(`${line}\n`);
|
|
14
|
+
}
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!existsSync(bundledCliPath)) {
|
|
19
|
+
fail([
|
|
20
|
+
"[pushpals] CLI bundle is missing in this package install.",
|
|
21
|
+
"[pushpals] Reinstall @pushpalsdev/cli, or download a direct binary from:",
|
|
22
|
+
`[pushpals] ${releaseUrl}`,
|
|
23
|
+
]);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function hasBunRuntime() {
|
|
27
|
+
if (process.platform === "win32") {
|
|
28
|
+
const probe = spawnSync("bun --version", { shell: true, stdio: "ignore" });
|
|
29
|
+
return probe.status === 0;
|
|
30
|
+
}
|
|
31
|
+
const probe = spawnSync("bun", ["--version"], { stdio: "ignore" });
|
|
32
|
+
return probe.status === 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!hasBunRuntime()) {
|
|
36
|
+
fail([
|
|
37
|
+
"[pushpals] Bun runtime is required for the npm package entrypoint.",
|
|
38
|
+
"[pushpals] Install Bun from https://bun.sh, or use a direct binary release:",
|
|
39
|
+
`[pushpals] ${releaseUrl}`,
|
|
40
|
+
]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function spawnBunCli() {
|
|
44
|
+
if (process.platform !== "win32") {
|
|
45
|
+
return spawn("bun", [bundledCliPath, ...process.argv.slice(2)], {
|
|
46
|
+
stdio: "inherit",
|
|
47
|
+
env: process.env,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const quoteWindows = (value) => `"${String(value).replace(/"/g, '\\"')}"`;
|
|
52
|
+
const commandLine = [
|
|
53
|
+
"bun",
|
|
54
|
+
quoteWindows(bundledCliPath),
|
|
55
|
+
...process.argv.slice(2).map(quoteWindows),
|
|
56
|
+
].join(" ");
|
|
57
|
+
return spawn(commandLine, {
|
|
58
|
+
shell: true,
|
|
59
|
+
stdio: "inherit",
|
|
60
|
+
env: process.env,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const child = spawnBunCli();
|
|
65
|
+
|
|
66
|
+
child.on("error", (err) => {
|
|
67
|
+
fail([`[pushpals] Failed to launch Bun runtime: ${String(err?.message ?? err)}`]);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
child.on("exit", (code, signal) => {
|
|
71
|
+
if (signal) {
|
|
72
|
+
process.kill(process.pid, signal);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
process.exit(code ?? 1);
|
|
76
|
+
});
|