feat(expansion-packs): enhance install script for C4 Architecture expansion pack

- Added checks for Windows line endings and provided automatic conversion to Unix format.
- Included instructions for users running the script in PowerShell to handle potential line ending issues.
- Updated directory checks to ensure the script is executed from the correct location and that the BMAD-METHOD root exists.
- Enhanced file copying process to create necessary BMAD-METHOD directories and copy relevant expansion pack files accordingly.
This commit is contained in:
Mo 2025-09-18 22:09:30 +00:00
parent 2e5bfbfcec
commit 8ea6e3f273
3 changed files with 243 additions and 13 deletions

View File

@ -0,0 +1,151 @@
@echo off
setlocal enabledelayedexpansion
echo.
echo 🏛️ BMAD C4 Architecture Expansion Pack Installer
echo ==================================================
echo.
REM Check if we're in the right directory
if not exist "agents\c4-architect.md" (
echo ❌ Error: Please run this script from the bmad-c4-architecture directory
echo Current directory: %CD%
pause
exit /b 1
)
REM Check if BMAD-METHOD root exists
if not exist "..\..\bmad-core" (
echo ❌ Error: BMAD-METHOD root directory not found
echo Expected: ..\..\bmad-core
echo Current directory: %CD%
pause
exit /b 1
)
echo 📁 Installing C4 Architecture Expansion Pack...
echo.
REM Create directories if they don't exist
if not exist "..\..\bmad-core\agents" mkdir "..\..\bmad-core\agents"
if not exist "..\..\bmad-core\tasks" mkdir "..\..\bmad-core\tasks"
if not exist "..\..\bmad-core\templates" mkdir "..\..\bmad-core\templates"
if not exist "..\..\bmad-core\data" mkdir "..\..\bmad-core\data"
if not exist "..\..\bmad-core\checklists" mkdir "..\..\bmad-core\checklists"
if not exist "..\..\bmad-core\agent-teams" mkdir "..\..\bmad-core\agent-teams"
if not exist "..\..\bmad-core\workflows" mkdir "..\..\bmad-core\workflows"
REM Copy agent files
echo 📄 Copying agent files...
copy "agents\c4-architect.md" "..\..\bmad-core\agents\" >nul
if errorlevel 1 (
echo ❌ Failed to copy agent files
pause
exit /b 1
)
REM Copy task files
echo 📄 Copying task files...
for %%f in (tasks\*.md) do (
copy "%%f" "..\..\bmad-core\tasks\" >nul
if errorlevel 1 (
echo ❌ Failed to copy task file: %%f
pause
exit /b 1
)
)
REM Copy template files
echo 📄 Copying template files...
for %%f in (templates\*.yaml) do (
copy "%%f" "..\..\bmad-core\templates\" >nul
if errorlevel 1 (
echo ❌ Failed to copy template file: %%f
pause
exit /b 1
)
)
REM Copy data files
echo 📄 Copying data files...
for %%f in (data\*.md) do (
copy "%%f" "..\..\bmad-core\data\" >nul
if errorlevel 1 (
echo ❌ Failed to copy data file: %%f
pause
exit /b 1
)
)
REM Copy checklist files
echo 📄 Copying checklist files...
for %%f in (checklists\*.md) do (
copy "%%f" "..\..\bmad-core\checklists\" >nul
if errorlevel 1 (
echo ❌ Failed to copy checklist file: %%f
pause
exit /b 1
)
)
REM Copy agent team files
echo 📄 Copying agent team files...
for %%f in (agent-teams\*.yaml) do (
copy "%%f" "..\..\bmad-core\agent-teams\" >nul
if errorlevel 1 (
echo ❌ Failed to copy agent team file: %%f
pause
exit /b 1
)
)
REM Copy workflow files
echo 📄 Copying workflow files...
for %%f in (workflows\*.yaml) do (
copy "%%f" "..\..\bmad-core\workflows\" >nul
if errorlevel 1 (
echo ❌ Failed to copy workflow file: %%f
pause
exit /b 1
)
)
echo.
echo ✅ Installation completed successfully!
echo.
echo 🎯 What's been installed:
echo - C4 Architect Agent (Simon)
echo - 9 specialized tasks for C4 model creation
echo - 4 interactive templates
echo - C4 model guidelines and best practices
echo - Quality assurance checklists
echo - 3 agent team configurations
echo - 2 specialized workflows
echo.
echo 🚀 Next steps:
echo 1. Go back to BMAD-METHOD root: cd ..\..
echo 2. Test the agent: node tools/cli.js agent c4-architect
echo 3. Set up Structurizr Lite for diagram visualization
echo.
echo 📚 For detailed usage instructions, see:
echo - expansion-packs/bmad-c4-architecture/README.md
echo - expansion-packs/bmad-c4-architecture/utils/structurizr-setup.md
echo.
REM Check for Docker
echo 🔍 Checking for Docker...
docker --version >nul 2>&1
if errorlevel 1 (
echo ⚠️ Docker not found. You can install Docker Desktop or use Java 17+ instead.
echo Visit: https://www.docker.com/products/docker-desktop/
) else (
echo ✅ Docker found - recommended for Structurizr Lite
echo 💡 To start Structurizr Lite with Docker:
echo docker pull structurizr/lite
echo docker run -it --rm -p 8080:8080 -v C:\structurizr:/usr/local/structurizr structurizr/lite
)
echo.
echo 🏛️ C4 Architecture Expansion Pack is ready to use!
echo.
pause

View File

@ -0,0 +1,47 @@
# BMAD C4 Architecture Expansion Pack Installation Script for PowerShell
# This script handles line ending conversion and runs the bash installer
Write-Host "🏛️ BMAD C4 Architecture Expansion Pack Installer (PowerShell)" -ForegroundColor Blue
Write-Host "================================================================" -ForegroundColor Blue
Write-Host ""
# Check if we're in the right directory
if (-not (Test-Path "agents\c4-architect.md")) {
Write-Host "❌ Error: Please run this script from the bmad-c4-architecture directory" -ForegroundColor Red
Write-Host "Current directory: $PWD" -ForegroundColor Red
exit 1
}
# Check if BMAD-METHOD root exists
if (-not (Test-Path "..\..\bmad-core")) {
Write-Host "❌ Error: BMAD-METHOD root directory not found" -ForegroundColor Red
Write-Host "Expected: ..\..\bmad-core" -ForegroundColor Red
Write-Host "Current directory: $PWD" -ForegroundColor Red
exit 1
}
# Fix line endings in install.sh
Write-Host "🔧 Fixing line endings in install.sh..." -ForegroundColor Blue
try {
(Get-Content install.sh -Raw) -replace "`r`n", "`n" | Set-Content install.sh -NoNewline
Write-Host "✅ Line endings converted successfully" -ForegroundColor Green
} catch {
Write-Host "⚠️ Could not convert line endings: $($_.Exception.Message)" -ForegroundColor Yellow
}
# Check if bash is available
if (Get-Command bash -ErrorAction SilentlyContinue) {
Write-Host "🚀 Running bash installer..." -ForegroundColor Blue
bash install.sh
} else {
Write-Host "❌ Bash not found. Please install Git for Windows or WSL" -ForegroundColor Red
Write-Host "Alternative: Use the Windows batch file (install.bat)" -ForegroundColor Yellow
exit 1
}
Write-Host ""
Write-Host "🏛️ Installation completed!" -ForegroundColor Green
Write-Host "Next steps:" -ForegroundColor Blue
Write-Host " 1. Go back to BMAD-METHOD root: cd ..\.." -ForegroundColor White
Write-Host " 2. Test the agent: node tools/cli.js agent c4-architect" -ForegroundColor White
Write-Host " 3. Set up Structurizr Lite for diagram visualization" -ForegroundColor White

View File

@ -12,6 +12,21 @@ YELLOW='\033[1;33m'
BLUE='\033[0;34m' BLUE='\033[0;34m'
NC='\033[0m' # No Color NC='\033[0m' # No Color
# Check for Windows line endings and fix them
if [ -f "install.sh" ] && file install.sh | grep -q "CRLF"; then
echo -e "${BLUE}🔧 Detected Windows line endings - fixing...${NC}"
# Convert Windows line endings to Unix line endings using sed
sed -i 's/\r$//' install.sh
echo -e "${GREEN}✅ Line endings converted successfully${NC}"
fi
# Check if we're running in PowerShell and provide instructions
if [ -n "$PSVersionTable" ] || [ -n "$POWERSHELL_DISTRIBUTION_CHANNEL" ]; then
echo -e "${YELLOW}⚠️ PowerShell detected. If you get line ending errors, run:${NC}"
echo -e "${BLUE} (Get-Content install.sh -Raw) -replace \"\`r\`n\", \"\`n\" | Set-Content install.sh -NoNewline${NC}"
echo
fi
# Configuration # Configuration
EXPANSION_PACK_NAME="bmad-c4-architecture" EXPANSION_PACK_NAME="bmad-c4-architecture"
TARGET_DIR=".bmad-c4-architecture" TARGET_DIR=".bmad-c4-architecture"
@ -20,10 +35,18 @@ SOURCE_DIR="$(dirname "$0")"
echo -e "${BLUE}🏛️ BMAD C4 Architecture Expansion Pack Installer${NC}" echo -e "${BLUE}🏛️ BMAD C4 Architecture Expansion Pack Installer${NC}"
echo "==================================================" echo "=================================================="
# Check if we're in a BMAD-METHOD project # Check if we're in the expansion pack directory and BMAD-METHOD root exists
if [ ! -f "package.json" ] || ! grep -q "bmad-method" package.json; then if [ ! -f "agents/c4-architect.md" ]; then
echo -e "${RED}❌ Error: This doesn't appear to be a BMAD-METHOD project.${NC}" echo -e "${RED}❌ Error: Please run this script from the bmad-c4-architecture directory${NC}"
echo "Please run this script from the root of a BMAD-METHOD project." echo "Current directory: $(pwd)"
exit 1
fi
# Check if BMAD-METHOD root exists
if [ ! -d "../../bmad-core" ]; then
echo -e "${RED}❌ Error: BMAD-METHOD root directory not found${NC}"
echo "Expected: ../../bmad-core"
echo "Current directory: $(pwd)"
exit 1 exit 1
fi fi
@ -40,16 +63,25 @@ if [ -d "$TARGET_DIR" ]; then
rm -rf "$TARGET_DIR" rm -rf "$TARGET_DIR"
fi fi
# Create target directory # Create BMAD-METHOD directories if they don't exist
echo -e "${BLUE}📁 Creating target directory...${NC}" echo -e "${BLUE}📁 Creating BMAD-METHOD directories...${NC}"
mkdir -p "$TARGET_DIR" mkdir -p "../../bmad-core/agents"
mkdir -p "../../bmad-core/tasks"
mkdir -p "../../bmad-core/templates"
mkdir -p "../../bmad-core/data"
mkdir -p "../../bmad-core/checklists"
mkdir -p "../../bmad-core/agent-teams"
mkdir -p "../../bmad-core/workflows"
# Copy expansion pack files # Copy expansion pack files to BMAD-METHOD
echo -e "${BLUE}📋 Copying expansion pack files...${NC}" echo -e "${BLUE}📋 Copying expansion pack files to BMAD-METHOD...${NC}"
cp -r "$SOURCE_DIR"/* "$TARGET_DIR/" cp agents/*.md "../../bmad-core/agents/"
cp tasks/*.md "../../bmad-core/tasks/"
# Remove the install script from target cp templates/*.yaml "../../bmad-core/templates/"
rm -f "$TARGET_DIR/install.sh" cp data/*.md "../../bmad-core/data/"
cp checklists/*.md "../../bmad-core/checklists/"
cp agent-teams/*.yaml "../../bmad-core/agent-teams/"
cp workflows/*.yaml "../../bmad-core/workflows/"
# Update core configuration # Update core configuration
echo -e "${BLUE}⚙️ Updating core configuration...${NC}" echo -e "${BLUE}⚙️ Updating core configuration...${NC}"