refactor(install): port venv bootstrap, config tools and gitignore exclusions to installer

- Port .venv creation and dependency pip install bootstrap sequence from deploy/install.sh into scripts/install_mam.sh
- Include .env.example and scripts/generate-env.sh copies under rsync target deployment
- Add .venv/ to target gitignore list to prevent virtualenv bloating
- Add empty-UUID resume safety guard in INSTALL.md
This commit is contained in:
2026-07-12 14:15:04 +09:00
parent 382c314d5e
commit 288132c7ba
2 changed files with 56 additions and 6 deletions
+4 -1
View File
@@ -72,7 +72,10 @@ $ SESSION_NAME="my-project-dev-claude"
$ UUID=$(bash .agents/skills/multi-agent-mux-resume/scripts/resolve_session_id.sh \
--workspace "$WORKSPACE" --agent "$AGENT" --session "$SESSION_NAME")
# 복원 대상 세션의 유효성 검사 (M-1)
$ [ -n "$UUID" ] || { echo "[ERROR] 매칭되는 활성 세션 이력이 없습니다. create_session.sh를 통해 먼저 세션을 생성해 주세요."; exit 1; }
# 2단계: 동적 격리 인자 주입 스폰 수행 후 레지스트리 상태 running 복구
# (상세 쉘 명령어는 .agents/skills/multi-agent-mux-resume/SKILL.md 참조)
```
+52 -5
View File
@@ -105,14 +105,26 @@ if ! python3 -c "import yaml, sqlite3" &>/dev/null; then
fi
log_ok "Dependency checks completed."
# 2. Copy .agents/ folder
# 2. Copy .agents/ folder and config tools
log_info "Deploying orchestration rules & skills (.agents/)..."
mkdir -p "$TARGET_DIR/.agents"
# Sync rules and skills, avoiding copying temporary or system files
# Exclude git histories, reports, logs or internal runtime cache if any
rsync -a --exclude='.git/' --exclude='/reports/' --exclude='*.log' --exclude='__pycache__/' --exclude='*.pyc' "$SRC_DIR/.agents/" "$TARGET_DIR/.agents/"
log_ok "Deployed Rules and Skills under target's .agents/"
# Copy config templates and generate scripts (M-2)
if [ -f "$SRC_DIR/.env.example" ]; then
cp "$SRC_DIR/.env.example" "$TARGET_DIR/.env.example"
log_ok "Copied .env.example configuration template"
fi
if [ -f "$SRC_DIR/scripts/generate-env.sh" ]; then
mkdir -p "$TARGET_DIR/scripts"
cp "$SRC_DIR/scripts/generate-env.sh" "$TARGET_DIR/scripts/generate-env.sh"
chmod +x "$TARGET_DIR/scripts/generate-env.sh"
log_ok "Copied scripts/generate-env.sh helper tool"
fi
# 3. Copy AGENTS.md to root or inject guidelines pointer
log_info "Configuring developer guidelines (AGENTS.md)..."
@@ -143,19 +155,54 @@ fi
log_info "Registering runtime isolation blocks in .gitignore..."
GITIGNORE="$TARGET_DIR/.gitignore"
MAM_PATTERN="/.mam/"
VENV_PATTERN="/.venv/"
if [ -f "$GITIGNORE" ]; then
# Register .mam/ if absent
if grep -Eq '^/?\.mam/?$' "$GITIGNORE"; then
log_ok ".mam/ already registered in target's .gitignore."
else
echo -e "\n# Multi-Agent Mux (MAM) runtime databases and isolation cache\n$MAM_PATTERN" >> "$GITIGNORE"
log_ok "Appended /.mam/ registration to .gitignore."
fi
# Register .venv/ if absent
if grep -Eq '^/?\.venv/?$' "$GITIGNORE"; then
log_ok ".venv/ already registered in target's .gitignore."
else
echo -e "\n# Python virtual environment\n$VENV_PATTERN" >> "$GITIGNORE"
log_ok "Appended /.venv/ registration to .gitignore."
fi
else
echo -e "# Multi-Agent Mux (MAM) runtime databases and isolation cache\n$MAM_PATTERN" > "$GITIGNORE"
log_ok "Created .gitignore with /.mam/ exclusion."
echo -e "# Multi-Agent Mux (MAM) runtime databases and isolation cache\n$MAM_PATTERN\n\n# Python virtual environment\n$VENV_PATTERN" > "$GITIGNORE"
log_ok "Created .gitignore with MAM and .venv exclusions."
fi
# 5. Python Virtual Environment Setup (F-1)
log_info "Bootstrapping Python virtual environment (.venv) in target..."
VENV_NAME="$TARGET_DIR/.venv"
if [ ! -d "$VENV_NAME" ]; then
python3 -m venv "$VENV_NAME"
log_ok "Virtual environment created."
else
log_info "Virtual environment (.venv) already exists. Skipping creation."
fi
# Upgrade pip and install dependencies inside target venv
# shellcheck disable=SC1091
source "$VENV_NAME"/bin/activate
pip install --upgrade pip
REQ_FILE="$TARGET_DIR/.agents/skills/multi-agent-mux-delegate-job/requirements.txt"
if [ -f "$REQ_FILE" ]; then
log_info "Installing dependencies from $REQ_FILE..."
pip install -r "$REQ_FILE"
log_ok "Dependencies installed successfully."
else
log_warn "Could not find requirements file: $REQ_FILE. Installing defaults."
pip install "paho-mqtt>=2.0.0" pyyaml
fi
deactivate
# Done
log_ok "MAM Installation completed successfully!"
cat <<EOF