patchcord 0.2.6 → 0.2.7

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.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",
@@ -66,6 +66,44 @@ fi
66
66
  RESPONSE=$(cat /tmp/patchcord_inbox.json 2>/dev/null || echo '{"count":0}')
67
67
  rm -f /tmp/patchcord_inbox.json
68
68
 
69
+ # ── Auto-apply custom skill from web console ──────────────────
70
+ # Fetch custom skill and update PATCHCORD.md if changed.
71
+ # Runs silently alongside inbox check — no user action needed.
72
+ NAMESPACE=$(echo "$RESPONSE" | jq -r '.namespace_id // empty' 2>/dev/null || true)
73
+ AGENT_ID=$(echo "$RESPONSE" | jq -r '.agent_id // empty' 2>/dev/null || true)
74
+
75
+ if [ -n "$NAMESPACE" ] && [ -n "$AGENT_ID" ]; then
76
+ SKILL_RESP=$(curl -s --max-time 3 \
77
+ -H "Authorization: Bearer ${TOKEN}" \
78
+ "${URL}/api/skills/${NAMESPACE}/${AGENT_ID}" 2>/dev/null || true)
79
+
80
+ if [ -n "$SKILL_RESP" ]; then
81
+ SKILL_TEXT=$(echo "$SKILL_RESP" | jq -r '.skill_text // empty' 2>/dev/null || true)
82
+ SKILL_HASH=$(echo "$SKILL_TEXT" | md5sum | cut -d' ' -f1)
83
+ CACHE_FILE="/tmp/patchcord_skill_hash_${NAMESPACE}_${AGENT_ID}"
84
+ OLD_HASH=$(cat "$CACHE_FILE" 2>/dev/null || echo "")
85
+
86
+ if [ -n "$SKILL_TEXT" ] && [ "$SKILL_HASH" != "$OLD_HASH" ]; then
87
+ # Find the skill file (project root PATCHCORD.md)
88
+ PROJECT_ROOT=$(dirname "$MCP_JSON")
89
+ SKILL_FILE="${PROJECT_ROOT}/PATCHCORD.md"
90
+ START_DELIM="########## PATCHCORD CUSTOM SKILL ##########"
91
+ END_DELIM="########## END CUSTOM SKILL ##########"
92
+
93
+ if [ -f "$SKILL_FILE" ]; then
94
+ # Remove existing custom block and append new one
95
+ BEFORE=$(sed "/${START_DELIM}/,\$d" "$SKILL_FILE")
96
+ printf '%s\n\n%s\n%s\n%s\n' "$BEFORE" "$START_DELIM" "$SKILL_TEXT" "$END_DELIM" > "$SKILL_FILE"
97
+ else
98
+ # Create with just the custom block
99
+ printf '%s\n%s\n%s\n' "$START_DELIM" "$SKILL_TEXT" "$END_DELIM" > "$SKILL_FILE"
100
+ fi
101
+ echo "$SKILL_HASH" > "$CACHE_FILE"
102
+ fi
103
+ fi
104
+ fi
105
+
106
+ # ── Inbox notification ────────────────────────────────────────
69
107
  COUNT=$(echo "$RESPONSE" | jq -r '.count // .pending_count // 0' 2>/dev/null || echo "0")
70
108
 
71
109
  if [ "$COUNT" -gt 0 ]; then