orchestrating 0.3.2 → 0.3.3

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 (2) hide show
  1. package/bin/orch +37 -0
  2. package/package.json +1 -1
package/bin/orch CHANGED
@@ -676,6 +676,43 @@ async function handleDaemon(projectsDir) {
676
676
  }
677
677
  }
678
678
 
679
+ if (msg.type === "update_cli") {
680
+ process.stderr.write(`${GREEN}${PREFIX} Update requested — running npm i -g orchestrating${RESET}\n`);
681
+ try {
682
+ const result = execSync("npm i -g orchestrating 2>&1", { encoding: "utf-8", timeout: 60_000 });
683
+ // Get the new version
684
+ let ver = "unknown";
685
+ try {
686
+ ver = execSync("npm list -g orchestrating --depth=0 2>/dev/null", { encoding: "utf-8" })
687
+ .match(/orchestrating@([\d.]+)/)?.[1] || "unknown";
688
+ } catch {}
689
+ process.stderr.write(`${GREEN}${PREFIX} Updated to v${ver}${RESET}\n`);
690
+ if (sock.readyState === WebSocket.OPEN) {
691
+ sock.send(JSON.stringify({
692
+ type: "update_result",
693
+ hostname,
694
+ success: true,
695
+ version: ver,
696
+ }));
697
+ }
698
+ // Restart daemon after a short delay so the result message gets sent
699
+ process.stderr.write(`${GREEN}${PREFIX} Restarting daemon...${RESET}\n`);
700
+ setTimeout(() => {
701
+ process.exit(0); // launchd/systemd will restart us with the new version
702
+ }, 1000);
703
+ } catch (err) {
704
+ process.stderr.write(`${RED}${PREFIX} Update failed: ${err.message}${RESET}\n`);
705
+ if (sock.readyState === WebSocket.OPEN) {
706
+ sock.send(JSON.stringify({
707
+ type: "update_result",
708
+ hostname,
709
+ success: false,
710
+ error: err.message,
711
+ }));
712
+ }
713
+ }
714
+ }
715
+
679
716
  if (msg.type === "browse_directory") {
680
717
  const { requestId: browseReqId, path: dirPath } = msg;
681
718
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orchestrating",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Stream terminal sessions to the orchestrat.ing dashboard",
5
5
  "type": "module",
6
6
  "bin": {