feat(identity): read claudetools_root from identity.json
- Updated sync.sh to read claudetools_root from identity.json - Updated syncro.md skill to use identity.json for repo path - Updated CLAUDE.md onboarding to include claudetools_root field - Eliminates cross-architecture path detection issues - Fallback to git rev-parse for legacy machines Each machine sets claudetools_root during onboarding, just like vault_path.
This commit is contained in:
@@ -54,25 +54,41 @@ TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
echo -e "${GREEN}[OK]${NC} Starting ClaudeTools sync from $MACHINE at $TIMESTAMP"
|
||||
|
||||
# Navigate to ClaudeTools directory
|
||||
# First check: are we already in the repo (or a subdirectory of it)?
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || true)
|
||||
if [ -n "$REPO_ROOT" ]; then
|
||||
cd "$REPO_ROOT"
|
||||
else
|
||||
# Fall back to known candidate paths
|
||||
# Read from identity.json (machine-specific, set during onboarding)
|
||||
IDENTITY_PATH=""
|
||||
for candidate in "$HOME/.claude/identity.json" ".claude/identity.json"; do
|
||||
if [ -f "$candidate" ]; then
|
||||
IDENTITY_PATH="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$IDENTITY_PATH" ] && command -v jq >/dev/null 2>&1; then
|
||||
REPO_ROOT=$(jq -r '.claudetools_root // empty' "$IDENTITY_PATH" 2>/dev/null)
|
||||
fi
|
||||
|
||||
# Fallback: git detection if identity.json doesn't have claudetools_root yet
|
||||
if [ -z "$REPO_ROOT" ]; then
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || true)
|
||||
fi
|
||||
|
||||
# Last resort: hardcoded paths (legacy machines)
|
||||
if [ -z "$REPO_ROOT" ]; then
|
||||
for candidate in "$HOME/ClaudeTools" "/d/ClaudeTools" "D:/ClaudeTools" "/d/claudetools" "D:/claudetools" "C:/claudetools" "/c/claudetools"; do
|
||||
if [ -d "$candidate/.git" ]; then
|
||||
cd "$candidate"
|
||||
REPO_ROOT="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ ! -d ".git" ]; then
|
||||
echo -e "${RED}[ERROR]${NC} Not in a git working tree"
|
||||
if [ -z "$REPO_ROOT" ] || [ ! -d "$REPO_ROOT/.git" ]; then
|
||||
echo -e "${RED}[ERROR]${NC} Cannot locate ClaudeTools repo. Add 'claudetools_root' to identity.json"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
echo -e "${GREEN}[OK]${NC} Working directory: $(pwd)"
|
||||
|
||||
# Detect Python interpreter — verify it actually runs (Windows Store stub passes command -v but fails to execute)
|
||||
|
||||
Reference in New Issue
Block a user