zdev 0.2.4 → 0.2.5

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
@@ -2773,8 +2773,10 @@ function getTmuxSessions(pattern) {
2773
2773
  }
2774
2774
  if (!result.success)
2775
2775
  return [];
2776
- return result.stdout.split(`
2777
- `).filter(Boolean).filter((name) => name.toLowerCase().includes(pattern.toLowerCase()));
2776
+ const sessions = result.stdout.split(`
2777
+ `).filter(Boolean);
2778
+ const patternWords = pattern.split("-").filter((w) => w.length > 2);
2779
+ return sessions.filter((name) => patternWords.some((word) => name.toLowerCase().includes(word.toLowerCase())));
2778
2780
  }
2779
2781
  async function list(options = {}) {
2780
2782
  const config = loadConfig();
@@ -2811,7 +2813,15 @@ No active features.
2811
2813
  const frontendRunning = alloc.pids.frontend ? isProcessRunning(alloc.pids.frontend) : false;
2812
2814
  const convexRunning = alloc.pids.convex ? isProcessRunning(alloc.pids.convex) : false;
2813
2815
  const featureSlug = name.toLowerCase().replace(/[^a-z0-9]/g, "-");
2814
- const tmuxSessions = getTmuxSessions(featureSlug);
2816
+ const projectSlug = alloc.project.toLowerCase().replace(/[^a-z0-9]/g, "-");
2817
+ const featureOnly = alloc.branch.replace("feature/", "").toLowerCase().replace(/[^a-z0-9]/g, "-");
2818
+ let tmuxSessions = getTmuxSessions(featureSlug);
2819
+ if (tmuxSessions.length === 0) {
2820
+ tmuxSessions = getTmuxSessions(projectSlug);
2821
+ }
2822
+ if (tmuxSessions.length === 0 && featureOnly !== projectSlug) {
2823
+ tmuxSessions = getTmuxSessions(featureOnly);
2824
+ }
2815
2825
  const hasTmux = tmuxSessions.length > 0;
2816
2826
  const isRunning = frontendRunning || convexRunning || hasTmux;
2817
2827
  const isFullyRunning = frontendRunning && convexRunning || hasTmux && tmuxSessions.length >= 2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zdev",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Multi-agent worktree development environment for cloud dev with preview URLs",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,10 +22,14 @@ function getTmuxSessions(pattern: string): string[] {
22
22
 
23
23
  if (!result.success) return [];
24
24
 
25
- return result.stdout
26
- .split("\n")
27
- .filter(Boolean)
28
- .filter(name => name.toLowerCase().includes(pattern.toLowerCase()));
25
+ const sessions = result.stdout.split("\n").filter(Boolean);
26
+
27
+ // Match if session name contains any word from the pattern
28
+ const patternWords = pattern.split("-").filter(w => w.length > 2);
29
+
30
+ return sessions.filter(name =>
31
+ patternWords.some(word => name.toLowerCase().includes(word.toLowerCase()))
32
+ );
29
33
  }
30
34
 
31
35
  export interface ListOptions {
@@ -74,8 +78,18 @@ export async function list(options: ListOptions = {}): Promise<void> {
74
78
  : false;
75
79
 
76
80
  // Check for tmux sessions related to this feature
81
+ // Try multiple patterns: full name, project name, feature name
77
82
  const featureSlug = name.toLowerCase().replace(/[^a-z0-9]/g, "-");
78
- const tmuxSessions = getTmuxSessions(featureSlug);
83
+ const projectSlug = alloc.project.toLowerCase().replace(/[^a-z0-9]/g, "-");
84
+ const featureOnly = alloc.branch.replace("feature/", "").toLowerCase().replace(/[^a-z0-9]/g, "-");
85
+
86
+ let tmuxSessions = getTmuxSessions(featureSlug);
87
+ if (tmuxSessions.length === 0) {
88
+ tmuxSessions = getTmuxSessions(projectSlug);
89
+ }
90
+ if (tmuxSessions.length === 0 && featureOnly !== projectSlug) {
91
+ tmuxSessions = getTmuxSessions(featureOnly);
92
+ }
79
93
  const hasTmux = tmuxSessions.length > 0;
80
94
 
81
95
  const isRunning = frontendRunning || convexRunning || hasTmux;