@jamiexiongr/panda 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +17 -0
  2. package/dist/cli.mjs +55 -4
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -1,3 +1,20 @@
1
1
  # @jamiexiongr/panda
2
2
 
3
3
  Combined installer and CLI entry for Panda.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ panda hub
9
+ panda hub tailscareserv
10
+
11
+ panda agent
12
+ panda agent tailscareserv
13
+ ```
14
+
15
+ `tailscareserv` and `--tailscale-serve` both enable automatic `tailscale serve` publishing.
16
+
17
+ ## Notes
18
+
19
+ - `panda hub tailscareserv` is the quickest path to a mobile-installable HTTPS PWA inside your tailnet.
20
+ - `panda agent tailscareserv` makes the agent register `https/wss` direct URLs when no explicit direct URL env vars are set.
package/dist/cli.mjs CHANGED
@@ -3,24 +3,75 @@ var printUsage = () => {
3
3
  console.log(`panda <command>
4
4
 
5
5
  Commands:
6
- agent Start the Panda agent service
7
- hub Start the Panda hub service with the bundled web UI
6
+ agent [tailscareserv] [--hub-url=<url>] Start the Panda agent service
7
+ hub [tailscareserv] Start the Panda hub service with the bundled web UI
8
8
  help Show this message`);
9
9
  };
10
+ var resolveCliOptionValue = (argv, aliases) => {
11
+ for (let index = 0; index < argv.length; index += 1) {
12
+ const candidate = argv[index]?.trim() ?? "";
13
+ const normalized = candidate.toLowerCase();
14
+ for (const alias of aliases) {
15
+ if (normalized === alias) {
16
+ return argv[index + 1]?.trim() || null;
17
+ }
18
+ if (normalized.startsWith(`${alias}=`)) {
19
+ return candidate.slice(alias.length + 1).trim() || null;
20
+ }
21
+ }
22
+ }
23
+ return null;
24
+ };
25
+ var resolveTailscaleServeArg = (argv) => {
26
+ for (const arg of argv) {
27
+ const normalized = arg.trim().toLowerCase();
28
+ if (["tailscareserv", "--tailscareserv", "tailscale-serve", "--tailscale-serve"].includes(
29
+ normalized
30
+ )) {
31
+ return true;
32
+ }
33
+ if (["no-tailscareserv", "--no-tailscareserv", "no-tailscale-serve", "--no-tailscale-serve"].includes(normalized)) {
34
+ return false;
35
+ }
36
+ }
37
+ const envValue = process.env.PANDA_TAILSCALE_SERVE?.trim().toLowerCase();
38
+ if (envValue && ["1", "true", "yes", "on"].includes(envValue)) {
39
+ return true;
40
+ }
41
+ if (envValue && ["0", "false", "no", "off"].includes(envValue)) {
42
+ return false;
43
+ }
44
+ return false;
45
+ };
10
46
  var main = async () => {
11
47
  const command = process.argv[2]?.trim().toLowerCase() ?? "help";
48
+ const commandArgs = process.argv.slice(3);
49
+ const tailscaleServe = resolveTailscaleServeArg(commandArgs);
12
50
  if (command === "help" || command === "--help" || command === "-h") {
13
51
  printUsage();
14
52
  return;
15
53
  }
16
54
  if (command === "agent") {
17
55
  const { startJamiexiongrAgent } = await import("@jamiexiongr/panda-agent");
18
- await startJamiexiongrAgent();
56
+ await startJamiexiongrAgent({
57
+ tailscaleServe,
58
+ hubUrl: resolveCliOptionValue(commandArgs, [
59
+ "hub",
60
+ "--hub",
61
+ "hub-url",
62
+ "--hub-url",
63
+ "huburl",
64
+ "--huburl"
65
+ ]),
66
+ argv: commandArgs
67
+ });
19
68
  return;
20
69
  }
21
70
  if (command === "hub") {
22
71
  const { startJamiexiongrHub } = await import("@jamiexiongr/panda-hub");
23
- await startJamiexiongrHub();
72
+ await startJamiexiongrHub({
73
+ tailscaleServe
74
+ });
24
75
  return;
25
76
  }
26
77
  console.error(`Unknown command: ${command}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jamiexiongr/panda",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "Panda combined installer",
@@ -8,8 +8,8 @@
8
8
  "panda": "./dist/cli.mjs"
9
9
  },
10
10
  "dependencies": {
11
- "@jamiexiongr/panda-agent": "0.1.0",
12
- "@jamiexiongr/panda-hub": "0.1.0"
11
+ "@jamiexiongr/panda-agent": "0.1.1",
12
+ "@jamiexiongr/panda-hub": "0.1.1"
13
13
  },
14
14
  "files": [
15
15
  "dist"