junhost 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.
package/bin/jun.js CHANGED
@@ -34,6 +34,7 @@ Usage: jun <command>
34
34
  Commands:
35
35
  start Start the daemon + dashboard (default; http://127.0.0.1:8787)
36
36
  doctor Check prerequisites (codex CLI, browser engine)
37
+ upgrade Update junhost to the latest published version
37
38
  mcp-server Run the self-management MCP server (spawned by Codex, stdio)
38
39
  version Print the version
39
40
 
@@ -89,6 +90,22 @@ switch (command) {
89
90
  case "doctor":
90
91
  await doctor();
91
92
  break;
93
+ case "upgrade": {
94
+ console.log(`Current version: ${version()}`);
95
+ const proc = Bun.spawnSync([process.execPath, "install", "-g", "junhost@latest"], {
96
+ stdout: "inherit",
97
+ stderr: "inherit",
98
+ });
99
+ if (proc.exitCode !== 0) {
100
+ console.error(
101
+ "\nUpgrade failed. If you installed with npm instead of bun, run:\n" +
102
+ " npm install -g junhost@latest",
103
+ );
104
+ process.exit(proc.exitCode ?? 1);
105
+ }
106
+ console.log("\nUpgrade complete. Restart the daemon (jun start) to run the new version.");
107
+ break;
108
+ }
92
109
  case "version":
93
110
  case "--version":
94
111
  case "-v":