iop/agent-ops/bin/init-agent-ops.sh

47 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
# agent-ops/bin/init-agent-ops.sh
# 프로젝트에 agent-ops 스캐폴드를 초기화하는 스크립트
set -e
if [ -z "$1" ]; then
echo "Usage: $0 <target_directory>"
exit 1
fi
TARGET_DIR=$(realpath "$1")
SOURCE_DIR=$(realpath "$(dirname "$0")/..")
echo "Initializing agent-ops in: $TARGET_DIR"
echo "Source agent-ops: $SOURCE_DIR"
# 1. 대상 폴더 생성
mkdir -p "$TARGET_DIR/agent-ops/rules/project/domain"
mkdir -p "$TARGET_DIR/agent-ops/rules/private"
mkdir -p "$TARGET_DIR/agent-ops/skills/project"
# 2. 공통 요소 복사 (프로젝트 전용 설정은 제외)
cp "$SOURCE_DIR/.version" "$TARGET_DIR/agent-ops/"
cp -r "$SOURCE_DIR/rules/common" "$TARGET_DIR/agent-ops/rules/"
cp -r "$SOURCE_DIR/skills/common" "$TARGET_DIR/agent-ops/skills/"
# 3. 에이전트 진입 파일 생성 (common/rules.md 복사)
COMMON_RULES="$SOURCE_DIR/rules/common/rules.md"
cp "$COMMON_RULES" "$TARGET_DIR/GEMINI.md"
cp "$COMMON_RULES" "$TARGET_DIR/CLAUDE.md"
cp "$COMMON_RULES" "$TARGET_DIR/AGENTS.md"
cp "$COMMON_RULES" "$TARGET_DIR/.cursorrules"
cp "$COMMON_RULES" "$TARGET_DIR/.clinerules"
# 4. .gitignore 설정
TOUCH_GITIGNORE="$TARGET_DIR/.gitignore"
touch "$TOUCH_GITIGNORE"
if ! grep -q "agent-ops/rules/private/" "$TOUCH_GITIGNORE"; then
echo "" >> "$TOUCH_GITIGNORE"
echo "# Agent-Ops Private Rules" >> "$TOUCH_GITIGNORE"
echo "agent-ops/rules/private/" >> "$TOUCH_GITIGNORE"
fi
echo "Successfully initialized agent-ops in $TARGET_DIR"
echo "Note: agent-ops/rules/project and agent-ops/skills/project are initialized as empty."