patchcord 0.3.85 → 0.3.86

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": "patchcord",
3
- "version": "0.3.85",
3
+ "version": "0.3.86",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",
@@ -1,19 +1,12 @@
1
1
  #!/bin/bash
2
2
  set -euo pipefail
3
3
 
4
- find_patchcord_mcp_json() {
5
- # Only check CWD itself — don't walk up.
6
- # Walking up leaks agent identity from parent dirs into unrelated projects.
7
- local dir="${1:-$PWD}"
8
- if [ -f "$dir/.mcp.json" ]; then
9
- printf '%s\n' "$dir/.mcp.json"
10
- return 0
11
- fi
12
- return 1
13
- }
14
-
15
4
  INPUT=$(cat)
16
5
 
6
+ # Get project cwd from Claude Code's input JSON, fall back to $PWD
7
+ PROJECT_CWD=$(echo "$INPUT" | jq -r '.cwd // empty' 2>/dev/null || true)
8
+ [ -z "$PROJECT_CWD" ] || [ "$PROJECT_CWD" = "null" ] && PROJECT_CWD="$PWD"
9
+
17
10
  # Guard against infinite loops: stop_hook_active is true when Claude
18
11
  # is already continuing because a previous Stop hook told it to.
19
12
  STOP_ACTIVE=$(echo "$INPUT" | jq -r '.stop_hook_active // false' 2>/dev/null || echo "false")
@@ -40,7 +33,8 @@ fi
40
33
  # Resolve config from project-scoped .mcp.json only.
41
34
  TOKEN=""
42
35
  URL=""
43
- MCP_JSON=$(find_patchcord_mcp_json "$PWD" || true)
36
+ MCP_JSON=""
37
+ [ -f "$PROJECT_CWD/.mcp.json" ] && MCP_JSON="$PROJECT_CWD/.mcp.json"
44
38
 
45
39
  if [ -n "$MCP_JSON" ]; then
46
40
  MCP_URL=$(jq -r '.mcpServers.patchcord.url // empty' "$MCP_JSON" 2>/dev/null || true)
@@ -94,7 +88,7 @@ if [ -n "$NAMESPACE" ] && [ -n "$AGENT_ID" ]; then
94
88
 
95
89
  if [ -n "$SKILL_RESP" ]; then
96
90
  SKILL_TEXT=$(echo "$SKILL_RESP" | jq -r '.skill_text // empty' 2>/dev/null || true)
97
- SKILL_HASH=$(echo "$SKILL_TEXT" | md5sum | cut -d' ' -f1)
91
+ SKILL_HASH=$(printf '%s' "$SKILL_TEXT" | (md5sum 2>/dev/null || md5 2>/dev/null) | cut -d' ' -f1 || echo "nohash")
98
92
  CACHE_FILE="/tmp/patchcord_skill_hash_${NAMESPACE}_${AGENT_ID}"
99
93
  OLD_HASH=$(cat "$CACHE_FILE" 2>/dev/null || echo "")
100
94
 
@@ -12,17 +12,6 @@ for arg in "$@"; do
12
12
  [ "$arg" = "--full" ] && FULL=true
13
13
  done
14
14
 
15
- find_patchcord_mcp_json() {
16
- # Only check CWD itself — don't walk up.
17
- # Walking up leaks agent identity from parent dirs into unrelated projects.
18
- local dir="$1"
19
- if [ -f "$dir/.mcp.json" ]; then
20
- printf '%s\n' "$dir/.mcp.json"
21
- return 0
22
- fi
23
- return 1
24
- }
25
-
26
15
  input=$(cat)
27
16
 
28
17
  if [ -z "$input" ]; then
@@ -48,7 +37,8 @@ cwd=$(echo "$input" | jq -r '.cwd // ""')
48
37
 
49
38
  pc_token=""
50
39
  pc_url=""
51
- mcp_json=$(find_patchcord_mcp_json "$cwd" || true)
40
+ mcp_json=""
41
+ [ -f "$cwd/.mcp.json" ] && mcp_json="$cwd/.mcp.json"
52
42
 
53
43
  if [ -n "$mcp_json" ]; then
54
44
  mcp_url=$(jq -r '.mcpServers.patchcord.url // empty' "$mcp_json" 2>/dev/null || true)