Update: init-project now copies agents to .claude/agents/

- Creates .claude/agents/ directory in each project
- Automatically copies agents from ~/.homelab-agents/agents/
- Makes agents available for Claude Code locally
- Agents can be referenced as .claude/agents/agent-name.md
- Gracefully handles missing agents
This commit is contained in:
root
2025-11-23 21:59:30 +00:00
parent d49801136a
commit 2f25d70674

View File

@@ -8,6 +8,7 @@
# - Creates a new project directory
# - Initializes git repository
# - Configures Gitea remote automatically
# - Copies agents to .claude/agents/ for Claude Code
# - Sets up git user info
set -e
@@ -24,6 +25,7 @@ fi
GITEA_URL="http://100.120.125.113:3000"
GITEA_ORG="pdm"
REPO_URL="$GITEA_URL/$GITEA_ORG/$PROJECT_NAME.git"
AGENTS_SOURCE="$HOME/.homelab-agents/agents"
# Check if directory already exists
if [[ -d "$PROJECT_NAME" ]]; then
@@ -44,6 +46,21 @@ git branch -M main
echo "🔗 Configuring Gitea remote..."
git remote add origin "$REPO_URL"
echo "📚 Setting up Claude Code agents..."
mkdir -p ".claude/agents"
# Copy agents from homelab-agents if available
if [[ -d "$AGENTS_SOURCE" ]]; then
cp "$AGENTS_SOURCE"/*.md ".claude/agents/" 2>/dev/null || true
AGENT_COUNT=$(find ".claude/agents" -name "*.md" | wc -l)
if [[ $AGENT_COUNT -gt 0 ]]; then
echo "✅ Copied $AGENT_COUNT agent(s) to .claude/agents/"
fi
else
echo "⚠️ Note: ~/.homelab-agents not found, agents not copied"
echo " You can manually copy agents later or run bootstrap-agents.sh"
fi
echo ""
echo "✅ Project initialized successfully!"
echo ""
@@ -52,9 +69,10 @@ echo " Name: $PROJECT_NAME"
echo " Directory: $(pwd)"
echo " Remote: $REPO_URL"
echo " Branch: main"
echo " Agents: .claude/agents/"
echo ""
echo "🚀 Next steps:"
echo " 1. Start working in this directory"
echo " 2. Create files and make changes"
echo " 3. When done, use the summary agent: ~/.homelab-agents/agents/sysadmin-session-closer.md"
echo " 3. When done, use the summary agent: .claude/agents/sysadmin-session-closer.md"
echo " 4. Agent will automatically commit and push to Gitea"