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:
@@ -8,6 +8,7 @@
|
|||||||
# - Creates a new project directory
|
# - Creates a new project directory
|
||||||
# - Initializes git repository
|
# - Initializes git repository
|
||||||
# - Configures Gitea remote automatically
|
# - Configures Gitea remote automatically
|
||||||
|
# - Copies agents to .claude/agents/ for Claude Code
|
||||||
# - Sets up git user info
|
# - Sets up git user info
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
@@ -24,6 +25,7 @@ fi
|
|||||||
GITEA_URL="http://100.120.125.113:3000"
|
GITEA_URL="http://100.120.125.113:3000"
|
||||||
GITEA_ORG="pdm"
|
GITEA_ORG="pdm"
|
||||||
REPO_URL="$GITEA_URL/$GITEA_ORG/$PROJECT_NAME.git"
|
REPO_URL="$GITEA_URL/$GITEA_ORG/$PROJECT_NAME.git"
|
||||||
|
AGENTS_SOURCE="$HOME/.homelab-agents/agents"
|
||||||
|
|
||||||
# Check if directory already exists
|
# Check if directory already exists
|
||||||
if [[ -d "$PROJECT_NAME" ]]; then
|
if [[ -d "$PROJECT_NAME" ]]; then
|
||||||
@@ -44,6 +46,21 @@ git branch -M main
|
|||||||
echo "🔗 Configuring Gitea remote..."
|
echo "🔗 Configuring Gitea remote..."
|
||||||
git remote add origin "$REPO_URL"
|
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 ""
|
||||||
echo "✅ Project initialized successfully!"
|
echo "✅ Project initialized successfully!"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -52,9 +69,10 @@ echo " Name: $PROJECT_NAME"
|
|||||||
echo " Directory: $(pwd)"
|
echo " Directory: $(pwd)"
|
||||||
echo " Remote: $REPO_URL"
|
echo " Remote: $REPO_URL"
|
||||||
echo " Branch: main"
|
echo " Branch: main"
|
||||||
|
echo " Agents: .claude/agents/"
|
||||||
echo ""
|
echo ""
|
||||||
echo "🚀 Next steps:"
|
echo "🚀 Next steps:"
|
||||||
echo " 1. Start working in this directory"
|
echo " 1. Start working in this directory"
|
||||||
echo " 2. Create files and make changes"
|
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"
|
echo " 4. Agent will automatically commit and push to Gitea"
|
||||||
Reference in New Issue
Block a user