diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index ca6f33c..14881cf 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -9,7 +9,7 @@ "name": "dx", "source": "./", "description": "Developer experience essentials: GitHub Actions debugging, conversation cloning/half-cloning, context handoffs, and Reddit research via Gemini CLI", - "version": "0.14.12" + "version": "0.14.13" } ] } diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 09a413a..898a868 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "dx", "description": "Developer experience essentials: GitHub Actions debugging, conversation cloning/half-cloning, context handoffs, and Reddit research via Gemini CLI", - "version": "0.14.12", + "version": "0.14.13", "author": { "name": "YK", "email": "yoyoyosss@wearehackerone.com" diff --git a/scripts/clone-conversation.sh b/scripts/clone-conversation.sh index 800cf0b..98847eb 100755 --- a/scripts/clone-conversation.sh +++ b/scripts/clone-conversation.sh @@ -299,6 +299,32 @@ clone_conversation() { # Touch the file to ensure it appears at the top of claude -r touch "$target_file" + # Override session title so resumed cloned session shows the [CLONED ...] tag. + # Claude Code 2.1.x stores titles as custom-title/agent-name records in the + # jsonl; it reads the LAST occurrence to determine the resumed session's name. + # The awk pass copies source records (with rewritten sessionId) but leaves the + # customTitle string alone — without this, cloned session inherits source's + # title (e.g. "career-reset-strategy") instead of the [CLONED ...] prefix. + local original_title + original_title=$(grep '"type":"custom-title"' "$source_file" 2>/dev/null | tail -1 | \ + grep -oE '"customTitle":"[^"]*"' | head -1 | \ + sed 's/"customTitle":"//;s/"$//' || true) + + local clone_title + if [ -n "$original_title" ]; then + clone_title="${clone_tag} ${original_title}" + else + clone_title="${clone_tag}" + fi + + # JSON-escape (backslash first, then double-quote) + local clone_title_esc + clone_title_esc=$(printf '%s' "$clone_title" | sed 's/\\/\\\\/g; s/"/\\"/g') + + echo "{\"type\":\"custom-title\",\"customTitle\":\"${clone_title_esc}\",\"sessionId\":\"${new_session}\"}" >> "$target_file" + echo "{\"type\":\"agent-name\",\"agentName\":\"${clone_title_esc}\",\"sessionId\":\"${new_session}\"}" >> "$target_file" + log_info "Set session title: ${clone_title}" + # Update history.jsonl log_info "Updating history file..." diff --git a/scripts/half-clone-conversation.sh b/scripts/half-clone-conversation.sh index ead2ce9..246d2c5 100755 --- a/scripts/half-clone-conversation.sh +++ b/scripts/half-clone-conversation.sh @@ -493,6 +493,32 @@ half_clone_conversation() { # Touch the file to ensure it appears at the top of claude -r touch "$target_file" + # Override session title so resumed half-cloned session shows the [HALF-CLONE ...] tag. + # Claude Code 2.1.x stores titles as custom-title/agent-name records in the + # jsonl; it reads the LAST occurrence to determine the resumed session's name. + # The awk pass copies source records (with rewritten sessionId) but leaves the + # customTitle string alone — without this, half-cloned session inherits source's + # title instead of the [HALF-CLONE ...] prefix. + local original_title + original_title=$(grep '"type":"custom-title"' "$source_file" 2>/dev/null | tail -1 | \ + grep -oE '"customTitle":"[^"]*"' | head -1 | \ + sed 's/"customTitle":"//;s/"$//' || true) + + local clone_title + if [ -n "$original_title" ]; then + clone_title="${clone_tag} ${original_title}" + else + clone_title="${clone_tag}" + fi + + # JSON-escape (backslash first, then double-quote) + local clone_title_esc + clone_title_esc=$(printf '%s' "$clone_title" | sed 's/\\/\\\\/g; s/"/\\"/g') + + echo "{\"type\":\"custom-title\",\"customTitle\":\"${clone_title_esc}\",\"sessionId\":\"${new_session}\"}" >> "$target_file" + echo "{\"type\":\"agent-name\",\"agentName\":\"${clone_title_esc}\",\"sessionId\":\"${new_session}\"}" >> "$target_file" + log_info "Set session title: ${clone_title}" + # Update history.jsonl log_info "Updating history file..."