zdev 0.2.3 → 0.2.4

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.js CHANGED
@@ -2764,6 +2764,18 @@ Run 'zdev list' to see active features`);
2764
2764
 
2765
2765
  // src/commands/list.ts
2766
2766
  import { existsSync as existsSync6 } from "fs";
2767
+ function getTmuxSessions(pattern) {
2768
+ const socketDir = process.env.CLAWDBOT_TMUX_SOCKET_DIR || "/tmp/clawdbot-tmux-sockets";
2769
+ const socket = `${socketDir}/clawdbot.sock`;
2770
+ let result = run("tmux", ["-S", socket, "list-sessions", "-F", "#{session_name}"]);
2771
+ if (!result.success) {
2772
+ result = run("tmux", ["list-sessions", "-F", "#{session_name}"]);
2773
+ }
2774
+ if (!result.success)
2775
+ return [];
2776
+ return result.stdout.split(`
2777
+ `).filter(Boolean).filter((name) => name.toLowerCase().includes(pattern.toLowerCase()));
2778
+ }
2767
2779
  async function list(options = {}) {
2768
2780
  const config = loadConfig();
2769
2781
  const allocations = Object.entries(config.allocations);
@@ -2798,7 +2810,12 @@ No active features.
2798
2810
  const worktreeExists = existsSync6(worktreePath);
2799
2811
  const frontendRunning = alloc.pids.frontend ? isProcessRunning(alloc.pids.frontend) : false;
2800
2812
  const convexRunning = alloc.pids.convex ? isProcessRunning(alloc.pids.convex) : false;
2801
- const statusEmoji = frontendRunning && convexRunning ? "\uD83D\uDFE2" : frontendRunning || convexRunning ? "\uD83D\uDFE1" : "\uD83D\uDD34";
2813
+ const featureSlug = name.toLowerCase().replace(/[^a-z0-9]/g, "-");
2814
+ const tmuxSessions = getTmuxSessions(featureSlug);
2815
+ const hasTmux = tmuxSessions.length > 0;
2816
+ const isRunning = frontendRunning || convexRunning || hasTmux;
2817
+ const isFullyRunning = frontendRunning && convexRunning || hasTmux && tmuxSessions.length >= 2;
2818
+ const statusEmoji = isFullyRunning ? "\uD83D\uDFE2" : isRunning ? "\uD83D\uDFE1" : "\uD83D\uDD34";
2802
2819
  console.log(`${statusEmoji} ${name}`);
2803
2820
  console.log(` Project: ${alloc.project}`);
2804
2821
  console.log(` Branch: ${alloc.branch}`);
@@ -2807,8 +2824,15 @@ No active features.
2807
2824
  if (alloc.funnelPath && traefikStatus.devDomain) {
2808
2825
  console.log(` Public: https://${alloc.funnelPath}.${traefikStatus.devDomain}`);
2809
2826
  }
2810
- console.log(` Frontend: ${frontendRunning ? `running (PID: ${alloc.pids.frontend})` : "stopped"}`);
2811
- console.log(` Convex: ${convexRunning ? `running (PID: ${alloc.pids.convex})` : "stopped"}`);
2827
+ if (alloc.pids.frontend || alloc.pids.convex) {
2828
+ console.log(` Frontend: ${frontendRunning ? `running (PID: ${alloc.pids.frontend})` : "stopped"}`);
2829
+ console.log(` Convex: ${convexRunning ? `running (PID: ${alloc.pids.convex})` : "stopped"}`);
2830
+ }
2831
+ if (hasTmux) {
2832
+ console.log(` Tmux: ${tmuxSessions.join(", ")}`);
2833
+ } else if (!frontendRunning && !convexRunning) {
2834
+ console.log(` Servers: stopped`);
2835
+ }
2812
2836
  console.log(` Started: ${new Date(alloc.started).toLocaleString()}`);
2813
2837
  console.log();
2814
2838
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zdev",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Multi-agent worktree development environment for cloud dev with preview URLs",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,7 +5,28 @@ import {
5
5
  ZEBU_HOME,
6
6
  WORKTREES_DIR,
7
7
  } from "../config.js";
8
- import { isProcessRunning, getTraefikStatus } from "../utils.js";
8
+ import { isProcessRunning, getTraefikStatus, run } from "../utils.js";
9
+
10
+ // Get tmux sessions matching a pattern
11
+ function getTmuxSessions(pattern: string): string[] {
12
+ const socketDir = process.env.CLAWDBOT_TMUX_SOCKET_DIR || "/tmp/clawdbot-tmux-sockets";
13
+ const socket = `${socketDir}/clawdbot.sock`;
14
+
15
+ // Try clawdbot socket first
16
+ let result = run("tmux", ["-S", socket, "list-sessions", "-F", "#{session_name}"]);
17
+
18
+ if (!result.success) {
19
+ // Fall back to default tmux socket
20
+ result = run("tmux", ["list-sessions", "-F", "#{session_name}"]);
21
+ }
22
+
23
+ if (!result.success) return [];
24
+
25
+ return result.stdout
26
+ .split("\n")
27
+ .filter(Boolean)
28
+ .filter(name => name.toLowerCase().includes(pattern.toLowerCase()));
29
+ }
9
30
 
10
31
  export interface ListOptions {
11
32
  json?: boolean;
@@ -52,8 +73,15 @@ export async function list(options: ListOptions = {}): Promise<void> {
52
73
  ? isProcessRunning(alloc.pids.convex)
53
74
  : false;
54
75
 
55
- const statusEmoji = frontendRunning && convexRunning ? "🟢" :
56
- frontendRunning || convexRunning ? "🟡" : "🔴";
76
+ // Check for tmux sessions related to this feature
77
+ const featureSlug = name.toLowerCase().replace(/[^a-z0-9]/g, "-");
78
+ const tmuxSessions = getTmuxSessions(featureSlug);
79
+ const hasTmux = tmuxSessions.length > 0;
80
+
81
+ const isRunning = frontendRunning || convexRunning || hasTmux;
82
+ const isFullyRunning = (frontendRunning && convexRunning) || (hasTmux && tmuxSessions.length >= 2);
83
+
84
+ const statusEmoji = isFullyRunning ? "🟢" : isRunning ? "🟡" : "🔴";
57
85
 
58
86
  console.log(`${statusEmoji} ${name}`);
59
87
  console.log(` Project: ${alloc.project}`);
@@ -65,8 +93,19 @@ export async function list(options: ListOptions = {}): Promise<void> {
65
93
  console.log(` Public: https://${alloc.funnelPath}.${traefikStatus.devDomain}`);
66
94
  }
67
95
 
68
- console.log(` Frontend: ${frontendRunning ? `running (PID: ${alloc.pids.frontend})` : "stopped"}`);
69
- console.log(` Convex: ${convexRunning ? `running (PID: ${alloc.pids.convex})` : "stopped"}`);
96
+ // Show PID-based status
97
+ if (alloc.pids.frontend || alloc.pids.convex) {
98
+ console.log(` Frontend: ${frontendRunning ? `running (PID: ${alloc.pids.frontend})` : "stopped"}`);
99
+ console.log(` Convex: ${convexRunning ? `running (PID: ${alloc.pids.convex})` : "stopped"}`);
100
+ }
101
+
102
+ // Show tmux sessions if any
103
+ if (hasTmux) {
104
+ console.log(` Tmux: ${tmuxSessions.join(", ")}`);
105
+ } else if (!frontendRunning && !convexRunning) {
106
+ console.log(` Servers: stopped`);
107
+ }
108
+
70
109
  console.log(` Started: ${new Date(alloc.started).toLocaleString()}`);
71
110
  console.log();
72
111
  }