Created
June 20, 2025 17:19
-
-
Save unbracketed/1eb09a54a4484ad123b7a0a51ffe7821 to your computer and use it in GitHub Desktop.
A script called when CCManager detects Claude Code state changes - logs status data and session info to skate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set defaults if environment variables are not defined | |
if [ -z "$CCMANAGER_WORKTREE" ]; then | |
CCMANAGER_WORKTREE=$(pwd) | |
fi | |
if [ -z "$CCMANAGER_WORKTREE_BRANCH" ]; then | |
# Check if we're in a git repository and get the branch name | |
if git rev-parse --git-dir > /dev/null 2>&1; then | |
CCMANAGER_WORKTREE_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) | |
else | |
CCMANAGER_WORKTREE_BRANCH="NO-REPO" | |
fi | |
fi | |
# current status for worktree | |
skate set "${CCMANAGER_WORKTREE_BRANCH}@ccmgr-status" "${CCMANAGER_NEW_STATE}" | |
# track active work | |
# Strip /Users/brian/code or ~/code prefix from the worktree path | |
STRIPPED_WORKTREE="${CCMANAGER_WORKTREE#/Users/brian/code/}" | |
STRIPPED_WORKTREE="${STRIPPED_WORKTREE#~/code/}" | |
skate set "${CCMANAGER_WORKTREE_BRANCH}@ccmgr-projects" "${STRIPPED_WORKTREE}" | |
# current sessions | |
# Strip /Users/brian/code or ~/code prefix from the key | |
STRIPPED_KEY="${CCMANAGER_WORKTREE#/Users/brian/code/}" | |
STRIPPED_KEY="${STRIPPED_KEY#~/code/}" | |
skate set "${STRIPPED_KEY}@ccmgr-sessions" "${CCMANAGER_SESSION_ID}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment