#!/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 # ============================================================================== 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/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 ]\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 chronological directory structure mkdir -p "$repo_root/01_BRD" mkdir -p "$repo_root/04_generated_documentation/00_process_control/checkpoints" mkdir -p "$repo_root/04_generated_documentation/01_source_inventories" mkdir -p "$repo_root/04_generated_documentation/03_requirements/use_cases" mkdir -p "$repo_root/04_generated_documentation/04_architecture_design/lld" mkdir -p "$repo_root/04_generated_documentation/05_iteration_planning/iterations" mkdir -p "$repo_root/04_generated_documentation/06_wireframes" mkdir -p "$repo_root/04_generated_documentation/07_test_design/manual_qa/workbooks" mkdir -p "$repo_root/04_generated_documentation/08_review_ready_baselines" mkdir -p "$repo_root/prompts" if [[ "$archetype" == "brownfield" ]]; then mkdir -p "$repo_root/02_legacy_source_code" mkdir -p "$repo_root/03_old_screenshots" mkdir -p "$repo_root/04_generated_documentation/02_legacy_analysis" fi printf '\nInitialization complete! Next steps:\n' printf '1. Add your requirements to 01_BRD/\n' if [[ "$archetype" == "brownfield" ]]; then printf '2. Place legacy code in 02_legacy_source_code/ and screenshots in 03_old_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"