gsd-init 1.0.14 → 1.0.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gsd-init",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "Set up GSD observer/worker tmux system in a project",
5
5
  "bin": {
6
6
  "gsd-init": "bin/gsd.js"
@@ -1,9 +1,51 @@
1
1
  #!/usr/bin/env bash
2
- WORKER_SESSION="${GSD_WORKER_SESSION:-gsd-worker}"
3
- OBSERVER_SESSION="${GSD_OBSERVER_SESSION:-gsd-observer}"
4
- echo "[gsd-observer] Tearing down sessions..."
2
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
3
+ PROJECT_DIR="$(cd "${SCRIPT_DIR}/../.." && pwd)"
4
+ PROJECT_NAME="$(basename "$PROJECT_DIR")"
5
+
6
+ WORKER_SESSION="${GSD_WORKER_SESSION:-gsd-worker-${PROJECT_NAME}}"
7
+ OBSERVER_SESSION="${GSD_OBSERVER_SESSION:-gsd-observer-${PROJECT_NAME}}"
8
+
9
+ echo "[gsd] Closing Terminal windows..."
10
+ osascript <<EOF 2>/dev/null || true
11
+ tell application "Terminal"
12
+ set wins to every window
13
+ repeat with w in wins
14
+ try
15
+ set cmd to custom title of w
16
+ on error
17
+ set cmd to ""
18
+ end try
19
+ if cmd contains "$WORKER_SESSION" or cmd contains "$OBSERVER_SESSION" then
20
+ close w
21
+ end if
22
+ end repeat
23
+ end tell
24
+ EOF
25
+
26
+ # Also close by matching the tmux attach command in the tab
27
+ osascript <<EOF 2>/dev/null || true
28
+ tell application "Terminal"
29
+ set wins to every window
30
+ repeat with w in wins
31
+ repeat with t in every tab of w
32
+ set p to processes of t
33
+ repeat with proc in p
34
+ if proc contains "$WORKER_SESSION" or proc contains "$OBSERVER_SESSION" then
35
+ close w
36
+ exit repeat
37
+ end if
38
+ end repeat
39
+ end repeat
40
+ end repeat
41
+ end tell
42
+ EOF
43
+
44
+ echo "[gsd] Tearing down sessions..."
5
45
  tmux kill-session -t "$WORKER_SESSION" 2>/dev/null && echo " Killed: $WORKER_SESSION" || echo " Not running: $WORKER_SESSION"
6
46
  tmux kill-session -t "$OBSERVER_SESSION" 2>/dev/null && echo " Killed: $OBSERVER_SESSION" || echo " Not running: $OBSERVER_SESSION"
7
- echo "[gsd-observer] Cleaning up temp files..."
47
+
48
+ echo "[gsd] Cleaning up temp files..."
8
49
  rm -f /tmp/gsd-event-*.json /tmp/gsd-response-*.json /tmp/gsd-last-event-phase
50
+
9
51
  echo " Done."