patchcord 0.3.10 → 0.3.11

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "patchcord",
3
3
  "description": "Cross-machine agent messaging with auto-inbox checking. Agents automatically respond to messages from other agents without human intervention.",
4
- "version": "0.3.10",
4
+ "version": "0.3.11",
5
5
  "author": {
6
6
  "name": "ppravdin"
7
7
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",
@@ -1,7 +1,11 @@
1
1
  #!/bin/bash
2
- # Enable the patchcord statusline in Claude Code user settings.
2
+ # Enable the patchcord statusline in Claude Code settings.
3
3
  # Usage: bash enable-statusline.sh [--full]
4
4
  # --full: also show model, context%, repo (branch)
5
+ #
6
+ # Writes to user-level ~/.claude/settings.json unless another
7
+ # tool's statusline is already set there — in that case, writes
8
+ # to project-level .claude/settings.json to avoid overwriting.
5
9
  set -euo pipefail
6
10
 
7
11
  EXTRA_ARGS=""
@@ -9,32 +13,7 @@ for arg in "$@"; do
9
13
  [ "$arg" = "--full" ] && EXTRA_ARGS=" --full"
10
14
  done
11
15
 
12
- # Find the project root (walk up from cwd to find .mcp.json with patchcord)
13
- find_project_root() {
14
- local dir="${1:-$(pwd)}"
15
- while [ -n "$dir" ] && [ "$dir" != "/" ]; do
16
- if [ -f "$dir/.mcp.json" ] && jq -e '.mcpServers.patchcord' "$dir/.mcp.json" >/dev/null 2>&1; then
17
- printf '%s\n' "$dir"
18
- return 0
19
- fi
20
- dir=$(dirname "$dir")
21
- done
22
- return 1
23
- }
24
-
25
- PROJECT_ROOT=$(find_project_root || true)
26
-
27
- if [ -n "$PROJECT_ROOT" ]; then
28
- # Project-level settings (only affects this repo)
29
- SETTINGS="$PROJECT_ROOT/.claude/settings.json"
30
- mkdir -p "$PROJECT_ROOT/.claude"
31
- else
32
- # Fallback to user-level if no project found
33
- SETTINGS="$HOME/.claude/settings.json"
34
- mkdir -p "$HOME/.claude"
35
- fi
36
-
37
- # Find the plugin's statusline script
16
+ # Find the statusline script path
38
17
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
39
18
  STATUSLINE="$SCRIPT_DIR/statusline.sh"
40
19
 
@@ -43,6 +22,47 @@ if [ ! -f "$STATUSLINE" ]; then
43
22
  exit 1
44
23
  fi
45
24
 
25
+ NEW_CMD="bash \"$STATUSLINE\"${EXTRA_ARGS}"
26
+
27
+ # Decide where to write
28
+ USER_SETTINGS="$HOME/.claude/settings.json"
29
+ mkdir -p "$HOME/.claude"
30
+
31
+ SETTINGS="$USER_SETTINGS"
32
+
33
+ if [ -f "$USER_SETTINGS" ]; then
34
+ EXISTING_CMD=$(jq -r '.statusLine.command // ""' "$USER_SETTINGS" 2>/dev/null || true)
35
+ if [ -n "$EXISTING_CMD" ]; then
36
+ # Already has a statusline — is it ours?
37
+ if echo "$EXISTING_CMD" | grep -q "patchcord"; then
38
+ # Ours — update in place (e.g. add/remove --full)
39
+ SETTINGS="$USER_SETTINGS"
40
+ else
41
+ # Another tool's statusline — don't overwrite, use project
42
+ find_project_root() {
43
+ local dir="${1:-$(pwd)}"
44
+ while [ -n "$dir" ] && [ "$dir" != "/" ]; do
45
+ if [ -f "$dir/.mcp.json" ] && jq -e '.mcpServers.patchcord' "$dir/.mcp.json" >/dev/null 2>&1; then
46
+ printf '%s\n' "$dir"
47
+ return 0
48
+ fi
49
+ dir=$(dirname "$dir")
50
+ done
51
+ return 1
52
+ }
53
+ PROJECT_ROOT=$(find_project_root || true)
54
+ if [ -n "$PROJECT_ROOT" ]; then
55
+ SETTINGS="$PROJECT_ROOT/.claude/settings.json"
56
+ mkdir -p "$PROJECT_ROOT/.claude"
57
+ else
58
+ # No project found — skip, don't overwrite another tool
59
+ echo "Statusline: another tool's statusline is set globally. Skipping."
60
+ exit 0
61
+ fi
62
+ fi
63
+ fi
64
+ fi
65
+
46
66
  # Read existing settings or start fresh
47
67
  if [ -f "$SETTINGS" ]; then
48
68
  CURRENT=$(cat "$SETTINGS")
@@ -51,10 +71,5 @@ else
51
71
  fi
52
72
 
53
73
  # Set statusLine field
54
- UPDATED=$(echo "$CURRENT" | jq --arg cmd "bash \"$STATUSLINE\"${EXTRA_ARGS}" '.statusLine = {"type": "command", "command": $cmd}')
74
+ UPDATED=$(echo "$CURRENT" | jq --arg cmd "$NEW_CMD" '.statusLine = {"type": "command", "command": $cmd}')
55
75
  echo "$UPDATED" > "$SETTINGS"
56
-
57
- echo "Patchcord statusline enabled."
58
- echo " Script: $STATUSLINE"
59
- echo " Settings: $SETTINGS"
60
- echo "Restart Claude Code to see the statusline."