patchcord 0.3.84 → 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/bin/patchcord.mjs +21 -20
- package/package.json +1 -1
- package/scripts/check-inbox.sh +7 -13
- package/scripts/statusline.sh +2 -12
package/bin/patchcord.mjs
CHANGED
|
@@ -391,30 +391,31 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd === "--token" || cmd ===
|
|
|
391
391
|
const rlU = createRLU({ input: process.stdin, output: process.stdout });
|
|
392
392
|
const askU = (q) => new Promise((resolve) => rlU.question(q, resolve));
|
|
393
393
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
if (existingIdentity) {
|
|
398
|
-
identity = existingIdentity;
|
|
399
|
-
const vResp = validateResp ? JSON.parse(validateResp) : {};
|
|
400
|
-
clientType = vResp.client_type || "";
|
|
401
|
-
choice = CLIENT_TYPE_MAP[clientType] || "";
|
|
402
|
-
console.log(` ${green}✓${r} ${bold}${identity}${r} — token valid`);
|
|
403
|
-
} else {
|
|
404
|
-
console.log(` ${yellow}⚠${r} Token expired or invalid. Starting fresh setup.`);
|
|
405
|
-
token = "";
|
|
406
|
-
}
|
|
394
|
+
// Q1: Add another agent? (most likely reason to re-run installer)
|
|
395
|
+
const addAnswer = (await askU(` ${bold}Add another agent to this project? (y/N):${r} `)).trim().toLowerCase();
|
|
396
|
+
if (addAnswer === "y" || addAnswer === "yes") {
|
|
407
397
|
rlU.close();
|
|
398
|
+
// Drop into browser connect flow — fresh setup for new agent
|
|
399
|
+
token = "";
|
|
408
400
|
} else {
|
|
409
|
-
//
|
|
410
|
-
const
|
|
401
|
+
// Q2: Update existing agent?
|
|
402
|
+
const updateAnswer = (await askU(` ${bold}Update ${existingToolName} agent? (y/N):${r} `)).trim().toLowerCase();
|
|
411
403
|
rlU.close();
|
|
412
|
-
if (
|
|
413
|
-
|
|
414
|
-
|
|
404
|
+
if (updateAnswer === "y" || updateAnswer === "yes") {
|
|
405
|
+
token = existingToken;
|
|
406
|
+
if (existingIdentity) {
|
|
407
|
+
identity = existingIdentity;
|
|
408
|
+
const vResp = validateResp ? JSON.parse(validateResp) : {};
|
|
409
|
+
clientType = vResp.client_type || "";
|
|
410
|
+
choice = CLIENT_TYPE_MAP[clientType] || "";
|
|
411
|
+
console.log(` ${green}✓${r} ${bold}${identity}${r} — token valid`);
|
|
412
|
+
} else {
|
|
413
|
+
console.log(` ${yellow}⚠${r} Token expired or invalid. Starting fresh setup.`);
|
|
414
|
+
token = "";
|
|
415
|
+
}
|
|
415
416
|
} else {
|
|
416
|
-
// Both N —
|
|
417
|
-
console.log(`\n ${dim}
|
|
417
|
+
// Both N — skills already updated by global setup, done
|
|
418
|
+
console.log(`\n ${dim}Skills updated.${r}`);
|
|
418
419
|
process.exit(0);
|
|
419
420
|
}
|
|
420
421
|
}
|
package/package.json
CHANGED
package/scripts/check-inbox.sh
CHANGED
|
@@ -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
|
|
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=$(
|
|
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
|
|
package/scripts/statusline.sh
CHANGED
|
@@ -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
|
|
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)
|