@faviovazquez/deliberate 0.2.9 → 0.2.10

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/BRAINSTORM.md CHANGED
@@ -302,7 +302,7 @@ The visual companion server is still running at http://localhost:{port}.
302
302
  Stop it now? (Y/n)
303
303
  ```
304
304
 
305
- - If **Y** or Enter: run `scripts/stop-server.sh` to shut it down cleanly.
305
+ - If **Y** or Enter: run `scripts/stop-server.sh {session_dir}` where `{session_dir}` is the `session_dir` value returned by `start-server.sh` in Phase 2. This stops the exact session that was started.
306
306
  - If **N**: leave it running. Remind the user it will auto-shutdown after 30 minutes of inactivity.
307
307
 
308
308
  If the visual companion was NOT active during this session, skip this phase.
package/README.md CHANGED
@@ -490,7 +490,10 @@ Stop it now? (Y/n)
490
490
 
491
491
  If you say yes (or press Enter), it runs `scripts/stop-server.sh` to shut it down cleanly. If you say no, the server keeps running — useful if you want to review the session in the browser after the deliberation ends. **It will auto-shutdown after 30 minutes of inactivity regardless.**
492
492
 
493
- If you ever need to manage the server manually:
493
+ If you ever need to manage the server manually, run these commands **from your project root**.
494
+
495
+ - `start-server.sh --project-dir .` stores the session under `.deliberate/companion/` in your project. This is what allows `stop-server.sh` to find and kill it automatically.
496
+ - `stop-server.sh` takes no arguments — it scans `.deliberate/companion/` and `/tmp/` to find running sessions and kills them.
494
497
 
495
498
  **Claude Code — global install:**
496
499
  ```bash
package/SKILL.md CHANGED
@@ -368,7 +368,7 @@ The visual companion server is still running at http://localhost:{port}.
368
368
  Stop it now? (Y/n)
369
369
  ```
370
370
 
371
- - If **Y** or Enter: run `scripts/stop-server.sh` to shut it down cleanly.
371
+ - If **Y** or Enter: run `scripts/stop-server.sh {session_dir}` where `{session_dir}` is the `session_dir` value returned by `start-server.sh` in Step 5c. This stops the exact session that was started.
372
372
  - If **N**: leave it running. Remind the user it will auto-shutdown after 30 minutes of inactivity.
373
373
 
374
374
  If the visual companion was NOT active during this session, skip this step.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faviovazquez/deliberate",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Multi-agent deliberation skill for AI coding assistants. Agreement is a bug.",
5
5
  "license": "MIT",
6
6
  "author": "Favio Vazquez",
@@ -1,42 +1,90 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
3
 
4
- # Stop a deliberate visual companion server session
4
+ # Stop a deliberate visual companion server session.
5
+ #
6
+ # Usage:
7
+ # stop-server.sh Auto-discover and stop all running sessions
8
+ # stop-server.sh SESSION_DIR Stop a specific session (coordinator use)
5
9
 
6
- if [[ $# -lt 1 ]]; then
7
- echo "Usage: stop-server.sh SESSION_DIR" >&2
8
- exit 1
9
- fi
10
+ stop_session() {
11
+ local SESSION_DIR="$1"
12
+ local STATE_DIR="$SESSION_DIR/state"
13
+ local SERVER_JS="$SESSION_DIR/server.js"
14
+
15
+ if [[ ! -d "$SESSION_DIR" ]]; then
16
+ echo "Session directory not found: $SESSION_DIR" >&2
17
+ return 1
18
+ fi
19
+
20
+ local PIDS
21
+ PIDS=$(pgrep -f "$SERVER_JS" 2>/dev/null || true)
22
+
23
+ if [[ -n "$PIDS" ]]; then
24
+ echo "$PIDS" | xargs kill 2>/dev/null || true
25
+ echo "Server stopped (session: $SESSION_DIR)"
26
+ else
27
+ echo "No running server found for session: $SESSION_DIR"
28
+ fi
29
+
30
+ # Mark as stopped
31
+ mkdir -p "$STATE_DIR"
32
+ echo "$(date +%s)" > "$STATE_DIR/server-stopped"
10
33
 
11
- SESSION_DIR="$1"
12
- STATE_DIR="$SESSION_DIR/state"
34
+ # Clean up /tmp sessions only
35
+ if [[ "$SESSION_DIR" == /tmp/* ]]; then
36
+ rm -rf "$SESSION_DIR"
37
+ echo "Temporary session cleaned up."
38
+ fi
39
+ }
13
40
 
14
- if [[ ! -d "$SESSION_DIR" ]]; then
15
- echo "Session directory not found: $SESSION_DIR" >&2
16
- exit 1
41
+ # ── With explicit SESSION_DIR arg (coordinator use) ────────────────────────
42
+ if [[ $# -ge 1 ]]; then
43
+ stop_session "$1"
44
+ exit 0
17
45
  fi
18
46
 
19
- # Read server info to find the process
20
- if [[ -f "$STATE_DIR/server-info" ]]; then
21
- # Find the node process serving this session
22
- SERVER_JS="$SESSION_DIR/server.js"
47
+ # ── No args: auto-discover all running deliberate companion sessions ────────
48
+ STOPPED=0
49
+
50
+ # Search project-local sessions (.deliberate/companion/)
51
+ for SERVER_JS in .deliberate/companion/*/server.js; do
52
+ [[ -f "$SERVER_JS" ]] || continue
53
+ SESSION_DIR="$(dirname "$SERVER_JS")"
23
54
  PIDS=$(pgrep -f "$SERVER_JS" 2>/dev/null || true)
55
+ if [[ -n "$PIDS" ]]; then
56
+ echo "$PIDS" | xargs kill 2>/dev/null || true
57
+ echo "Server stopped (session: $SESSION_DIR)"
58
+ mkdir -p "$SESSION_DIR/state"
59
+ echo "$(date +%s)" > "$SESSION_DIR/state/server-stopped"
60
+ STOPPED=$((STOPPED + 1))
61
+ fi
62
+ done
24
63
 
64
+ # Search /tmp sessions
65
+ for SERVER_JS in /tmp/deliberate-companion/*/server.js; do
66
+ [[ -f "$SERVER_JS" ]] || continue
67
+ SESSION_DIR="$(dirname "$SERVER_JS")"
68
+ PIDS=$(pgrep -f "$SERVER_JS" 2>/dev/null || true)
69
+ if [[ -n "$PIDS" ]]; then
70
+ echo "$PIDS" | xargs kill 2>/dev/null || true
71
+ echo "Server stopped (session: $SESSION_DIR)"
72
+ rm -rf "$SESSION_DIR"
73
+ echo "Temporary session cleaned up."
74
+ STOPPED=$((STOPPED + 1))
75
+ fi
76
+ done
77
+
78
+ # Fallback: kill any node process running a deliberate server.js
79
+ if [[ "$STOPPED" -eq 0 ]]; then
80
+ PIDS=$(pgrep -f "deliberate-companion.*/server.js" 2>/dev/null || true)
25
81
  if [[ -n "$PIDS" ]]; then
26
82
  echo "$PIDS" | xargs kill 2>/dev/null || true
27
83
  echo "Server stopped."
28
- else
29
- echo "No running server found for this session."
84
+ STOPPED=$((STOPPED + 1))
30
85
  fi
31
86
  fi
32
87
 
33
- # Mark as stopped
34
- echo "$(date +%s)" > "$STATE_DIR/server-stopped"
35
-
36
- # Clean up /tmp sessions only
37
- if [[ "$SESSION_DIR" == /tmp/* ]]; then
38
- rm -rf "$SESSION_DIR"
39
- echo "Temporary session cleaned up."
40
- else
41
- echo "Session files preserved at: $SESSION_DIR"
88
+ if [[ "$STOPPED" -eq 0 ]]; then
89
+ echo "No running deliberate visual companion server found."
42
90
  fi