Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .claude/settings.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"Bash(tmux list-windows:*)",
"Bash(ls:*)",
"Bash(cat:*)",
"Bash(grep:*)"
"Bash(grep:*)",
"Bash(test:*)",
"Bash(shellcheck:*)"
]
},
"enableAllProjectMcpServers": true,
Expand Down
8 changes: 8 additions & 0 deletions build/docker-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,14 @@ else
fi
fi

# Create symlink from ~/.claude/agents to ~/.claudebox/agents
# The ~/.claudebox folder is mounted from the host
if [ -d "$HOME/.claudebox/agents" ]; then
if [ ! -e "$HOME/.claude/agents" ]; then
ln -s "$HOME/.claudebox/agents" "$HOME/.claude/agents"
fi
fi

cd /workspace

# Check if .claude/projects exists and filter out -c/--continue if not
Expand Down
50 changes: 50 additions & 0 deletions lib/project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,56 @@ sync_commands_to_project() {
echo "$user_checksum" > "$user_checksum_file"
fi

# Sync user agents (similar to commands)
local agents_source="$HOME/.claude/agents"
local agents_dir="$project_parent/agents"
local agents_checksum_file="$project_parent/.agents_checksum"
local agents_checksum=""

# Calculate checksum for agents if directory exists
if [[ -d "$agents_source" ]]; then
agents_checksum=$(find "$agents_source" -type f -exec stat -f "%m" {} \; 2>/dev/null | sort | md5 2>/dev/null || \
find "$agents_source" -type f -exec stat -c "%Y" {} \; 2>/dev/null | sort | md5sum | cut -d' ' -f1)

# Check if sync needed
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
local sync_agents=false
if [[ ! -f "$agents_checksum_file" ]]; then
sync_agents=true
elif [[ "$(cat "$agents_checksum_file" 2>/dev/null)" != "$agents_checksum" ]]; then
sync_agents=true
fi

# Sync agents if needed
if [[ "$sync_agents" == "true" ]]; then
if [[ "$VERBOSE" == "true" ]]; then
echo "[DEBUG] Syncing agents to $agents_dir" >&2
fi

# Remove old agents and recreate
rm -rf "$agents_dir"
mkdir -p "$agents_dir"

# Copy preserving directory structure
if cd "$agents_source"; then
find . -type f | while read -r file; do
local dir=$(dirname "$file")
mkdir -p "$agents_dir/$dir"
cp "$file" "$agents_dir/$file"
done
cd - >/dev/null
fi

# Save checksum
echo "$agents_checksum" > "$agents_checksum_file"
fi
fi

# Clean up agents directory if source doesn't exist
if [[ ! -d "$agents_source" ]] && [[ -d "$agents_dir" ]]; then
rm -rf "$agents_dir"
rm -f "$agents_checksum_file"
fi

# Clean up empty directories if sources don't exist
if [[ ! -d "$cbox_source" ]] && [[ -d "$commands_dir/cbox" ]]; then
rm -rf "$commands_dir/cbox"
Expand Down
Loading