squad-bmad 1.2.3 → 1.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/bin/cli.js CHANGED
@@ -228,6 +228,8 @@ async function install() {
228
228
  console.log(` ${c.cyan}English:${c.reset} ${c.bold}/withClaudeCodeTmux${c.reset}`);
229
229
  console.log(` ${c.cyan}Tiếng Việt:${c.reset} ${c.bold}/withClaudeCodeTmux.vi${c.reset}`);
230
230
  console.log();
231
+ info(`To tear down all sessions when done: ${c.bold}.gemini/scripts/teardown-sessions.sh${c.reset}`);
232
+ console.log();
231
233
  }
232
234
 
233
235
  // ── Command: upgrade ─────────────────────────────────────────────────────────
@@ -260,6 +262,8 @@ async function upgrade() {
260
262
  console.log(` ${c.cyan}English:${c.reset} ${c.bold}/withClaudeCodeTmux${c.reset}`);
261
263
  console.log(` ${c.cyan}Tiếng Việt:${c.reset} ${c.bold}/withClaudeCodeTmux.vi${c.reset}`);
262
264
  console.log();
265
+ info(`To tear down all sessions when done: ${c.bold}.gemini/scripts/teardown-sessions.sh${c.reset}`);
266
+ console.log();
263
267
  }
264
268
 
265
269
  // ── Entry point ───────────────────────────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squad-bmad",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Automated project orchestration boilerplate with Gemini CLI & Claude Code via Tmux, following the BMAD methodology.",
5
5
  "keywords": [
6
6
  "gemini",
@@ -7,9 +7,20 @@ if [ -z "$MSG" ]; then
7
7
  fi
8
8
 
9
9
  # --- Dynamic Gemini session target ---
10
- # Derive the tmux session name from the current project folder.
10
+ # Derive the tmux session name from the project ROOT folder name.
11
+ # We use `git rev-parse --show-toplevel` to resolve from any subdirectory
12
+ # to the git root, then take its basename.
11
13
  # Convention: gemini-orchestrator-<folder-name>
12
- FOLDER_NAME=$(basename "$PWD")
14
+ GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "")
15
+
16
+ if [ -n "$GIT_ROOT" ]; then
17
+ FOLDER_NAME=$(basename "$GIT_ROOT")
18
+ else
19
+ # Fallback: if not inside a git repo, use PWD directly
20
+ echo "[notify-gemini] Warning: not inside a git repo. Falling back to basename of PWD." >&2
21
+ FOLDER_NAME=$(basename "$PWD")
22
+ fi
23
+
13
24
  GEMINI_SESSION="gemini-orchestrator-${FOLDER_NAME}"
14
25
 
15
26
  # Check whether the target tmux session actually exists before sending
@@ -15,8 +15,10 @@ AGENT_NAME=$(echo "$HOOK_INPUT" | jq -r '.agent // empty')
15
15
  # Example: if [ -n "$AGENT_NAME" ] && [ "$AGENT_NAME" != "root" ]; then exit 0; fi
16
16
 
17
17
  # --- Dynamic Gemini session target ---
18
- # Derive the tmux session name from the project folder name in the hook's cwd.
19
- # Convention: gemini-orchestrator-<folder-name> (e.g. cwd=/…/squad-bmad gemini-orchestrator-squad-bmad)
18
+ # Derive the tmux session name from the project ROOT folder name.
19
+ # We use `git rev-parse --show-toplevel` to resolve from any subdirectory
20
+ # to the git root, then take its basename.
21
+ # Convention: gemini-orchestrator-<folder-name> (e.g. cwd=/…/squad-bmad/frontend → gemini-orchestrator-squad-bmad)
20
22
  CWD=$(echo "$HOOK_INPUT" | jq -r '.cwd // empty')
21
23
 
22
24
  if [ -z "$CWD" ]; then
@@ -24,7 +26,17 @@ if [ -z "$CWD" ]; then
24
26
  exit 0
25
27
  fi
26
28
 
27
- FOLDER_NAME=$(basename "$CWD")
29
+ # Resolve to git root so subdirectories (e.g. frontend/) don't break session lookup
30
+ GIT_ROOT=$(git -C "$CWD" rev-parse --show-toplevel 2>/dev/null || echo "")
31
+
32
+ if [ -n "$GIT_ROOT" ]; then
33
+ FOLDER_NAME=$(basename "$GIT_ROOT")
34
+ else
35
+ # Fallback: if not inside a git repo, use cwd directly
36
+ echo "[wakeup-gemini] Warning: '$CWD' is not inside a git repo. Falling back to basename of cwd." >&2
37
+ FOLDER_NAME=$(basename "$CWD")
38
+ fi
39
+
28
40
  GEMINI_SESSION="gemini-orchestrator-${FOLDER_NAME}"
29
41
 
30
42
  # Check whether the target tmux session actually exists before sending
@@ -21,7 +21,13 @@ set -e
21
21
  if [ -n "$1" ]; then
22
22
  FOLDER="$1"
23
23
  else
24
- FOLDER=$(basename "$PWD")
24
+ # Use git root to resolve correctly from any subdirectory
25
+ GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "")
26
+ if [ -n "$GIT_ROOT" ]; then
27
+ FOLDER=$(basename "$GIT_ROOT")
28
+ else
29
+ FOLDER=$(basename "$PWD")
30
+ fi
25
31
  fi
26
32
 
27
33
  # ── Derive session names ─────────────────────────────────────────────────────
@@ -0,0 +1,78 @@
1
+ #!/bin/bash
2
+ # teardown-sessions.sh — Kill the 3 standard tmux sessions for a project.
3
+ #
4
+ # CONVENTION (matches setup-sessions.sh):
5
+ # gemini-orchestrator-<folder> → Gemini CLI
6
+ # claude-implement-<folder> → Claude Code (sonnet)
7
+ # claude-brainstorm-<folder> → Claude Code (opus)
8
+ #
9
+ # USAGE:
10
+ # .gemini/scripts/teardown-sessions.sh [folder-name]
11
+ #
12
+ # If folder-name is omitted, the name of the git root directory is used.
13
+ #
14
+ # EXAMPLES:
15
+ # .gemini/scripts/teardown-sessions.sh
16
+ # .gemini/scripts/teardown-sessions.sh squad-bmad
17
+
18
+ set -e
19
+
20
+ # ── Resolve folder name ──────────────────────────────────────────────────────
21
+ if [ -n "$1" ]; then
22
+ FOLDER="$1"
23
+ else
24
+ GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "")
25
+ if [ -n "$GIT_ROOT" ]; then
26
+ FOLDER=$(basename "$GIT_ROOT")
27
+ else
28
+ FOLDER=$(basename "$PWD")
29
+ fi
30
+ fi
31
+
32
+ # ── Derive session names ─────────────────────────────────────────────────────
33
+ SESSION_GEMINI="gemini-orchestrator-${FOLDER}"
34
+ SESSION_IMPLEMENT="claude-implement-${FOLDER}"
35
+ SESSION_BRAINSTORM="claude-brainstorm-${FOLDER}"
36
+
37
+ # ── Helper: kill session if it exists ─────────────────────────────────────────
38
+ kill_session_if_exists() {
39
+ local session_name="$1"
40
+ local label="$2"
41
+
42
+ if tmux has-session -t "$session_name" 2>/dev/null; then
43
+ tmux kill-session -t "$session_name"
44
+ echo " [KILLED] $label → session '${session_name}' terminated."
45
+ else
46
+ echo " [SKIP] $label → session '${session_name}' not found."
47
+ fi
48
+ }
49
+
50
+ # ── Print plan ────────────────────────────────────────────────────────────────
51
+ echo ""
52
+ echo "╔══════════════════════════════════════════════════════════════╗"
53
+ echo "║ squad-bmad • Session Teardown ║"
54
+ echo "╚══════════════════════════════════════════════════════════════╝"
55
+ echo ""
56
+ echo " Project folder : ${FOLDER}"
57
+ echo ""
58
+ echo " Sessions to kill:"
59
+ echo " 1. ${SESSION_GEMINI}"
60
+ echo " 2. ${SESSION_IMPLEMENT}"
61
+ echo " 3. ${SESSION_BRAINSTORM}"
62
+ echo ""
63
+
64
+ # ── Kill sessions ─────────────────────────────────────────────────────────────
65
+ kill_session_if_exists "$SESSION_GEMINI" "Gemini Orchestrator"
66
+ kill_session_if_exists "$SESSION_IMPLEMENT" "Claude Implement (Sonnet)"
67
+ kill_session_if_exists "$SESSION_BRAINSTORM" "Claude Brainstorm (Opus)"
68
+
69
+ # ── Summary ───────────────────────────────────────────────────────────────────
70
+ echo ""
71
+ REMAINING=$(tmux list-sessions 2>/dev/null || true)
72
+ if [ -n "$REMAINING" ]; then
73
+ echo "Remaining tmux sessions:"
74
+ echo "$REMAINING" | sed 's/^/ /'
75
+ else
76
+ echo "No tmux sessions remaining."
77
+ fi
78
+ echo ""