94 lines
3.3 KiB
Bash
Executable File
94 lines
3.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# ==============================================================================
|
|
# UP-AI v1.0 Generic Project Initializer
|
|
# ==============================================================================
|
|
# Helper script to initialize a new project workspace from the UP-AI template.
|
|
#
|
|
# Usage:
|
|
# ./scripts/init-new-project.sh --name "My Project" --code "MYP" --archetype <greenfield|brownfield>
|
|
# ==============================================================================
|
|
|
|
set -euo pipefail
|
|
|
|
script_dir="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
repo_root="$script_dir"
|
|
while [[ "$repo_root" != "/" && ! -f "$repo_root/tech-profile.yaml" && ! -d "$repo_root/project_sdlc" && ! -d "$repo_root/04_generated_documentation" ]]; do
|
|
repo_root="$(dirname "$repo_root")"
|
|
done
|
|
if [[ "$repo_root" == "/" ]]; then
|
|
repo_root="$(CDPATH= cd -- "$script_dir/../.." && pwd)"
|
|
fi
|
|
|
|
project_name="New Project"
|
|
project_code="NP"
|
|
archetype="greenfield"
|
|
|
|
usage() {
|
|
printf 'Usage: %s [--name "Project Name"] [--code "CODE"] [--archetype <greenfield|brownfield>]\n' "$0" >&2
|
|
exit 1
|
|
}
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--name)
|
|
project_name="${2:-}"
|
|
shift 2
|
|
;;
|
|
--code)
|
|
project_code="${2:-}"
|
|
shift 2
|
|
;;
|
|
--archetype)
|
|
archetype="${2:-greenfield}"
|
|
shift 2
|
|
;;
|
|
-h|--help)
|
|
usage
|
|
;;
|
|
*)
|
|
printf 'Unknown argument: %s\n' "$1" >&2
|
|
usage
|
|
;;
|
|
esac
|
|
done
|
|
|
|
printf '== Initializing UP-AI v1.5 for [%s] (Code: %s, Archetype: %s) ==\n' "$project_name" "$project_code" "$archetype"
|
|
|
|
# 1. Initialize tech-profile.yaml if not present
|
|
if [[ ! -f "$repo_root/tech-profile.yaml" ]]; then
|
|
if [[ -f "$repo_root/process/templates/tech-profile.template.yaml" ]]; then
|
|
printf 'Creating tech-profile.yaml from template...\n'
|
|
cp "$repo_root/process/templates/tech-profile.template.yaml" "$repo_root/tech-profile.yaml"
|
|
sed -i "s/name: .*/name: \"$project_name\"/" "$repo_root/tech-profile.yaml"
|
|
sed -i "s/code: .*/code: \"$project_code\"/" "$repo_root/tech-profile.yaml"
|
|
sed -i "s/archetype: .*/archetype: \"$archetype\"/" "$repo_root/tech-profile.yaml"
|
|
fi
|
|
fi
|
|
|
|
|
|
# 2. Create 3-directory top-level structure (UP-AI v1.5 PCR-007)
|
|
mkdir -p "$repo_root/project_sdlc/00_process_control/checkpoints"
|
|
mkdir -p "$repo_root/project_sdlc/01_BRD"
|
|
mkdir -p "$repo_root/project_sdlc/prompts"
|
|
mkdir -p "$repo_root/project_code"
|
|
touch "$repo_root/project_code/.gitkeep"
|
|
|
|
# 3. Create root symlinks to process and SDLC assets
|
|
ln -sf process/.agents "$repo_root/.agents"
|
|
ln -sf process/scripts "$repo_root/scripts"
|
|
ln -sf process/AGENTS.md "$repo_root/AGENTS.md"
|
|
ln -sf process/CLAUDE.md "$repo_root/CLAUDE.md"
|
|
ln -sf process/GEMINI.md "$repo_root/GEMINI.md"
|
|
|
|
if [[ "$archetype" == "brownfield" ]]; then
|
|
mkdir -p "$repo_root/project_sdlc/02_legacy_analysis"
|
|
fi
|
|
|
|
printf '\nInitialization complete! Next steps:\n'
|
|
printf '1. Add your requirements to project_sdlc/01_BRD/\n'
|
|
if [[ "$archetype" == "brownfield" ]]; then
|
|
printf '2. Place legacy code in project_sdlc/02_legacy_analysis/legacy_code/ and screenshots in project_sdlc/02_legacy_analysis/screenshots/\n'
|
|
fi
|
|
printf '3. Review and customize tech-profile.yaml with your stack choices\n'
|
|
printf '4. In your AI IDE, run: /up-project-bootstrap --archetype %s\n' "$archetype"
|