-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·48 lines (38 loc) · 1.31 KB
/
bootstrap.sh
File metadata and controls
executable file
·48 lines (38 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -lt 1 ]]; then
echo "Usage: $0 <new-project-name> [target-dir]"
echo "Example: $0 my-observability-app /Volumes/Workspace/products"
exit 1
fi
PROJECT_NAME="$1"
TARGET_BASE="${2:-$(pwd)/..}"
SRC_DIR="$(pwd)"
TARGET_DIR="$TARGET_BASE/$PROJECT_NAME"
if [[ -e "$TARGET_DIR" ]]; then
echo "Error: target already exists: $TARGET_DIR"
exit 1
fi
mkdir -p "$TARGET_BASE"
cp -R "$SRC_DIR" "$TARGET_DIR"
cd "$TARGET_DIR"
rm -rf .git
git init >/dev/null
if git rev-parse --verify master >/dev/null 2>&1; then
git branch -m main || true
fi
# Replace placeholders in common files (safe scope)
find README.md specs tasks -type f \( -name "*.md" -o -name "*.yaml" -o -name "*.yml" \) -print0 \
| xargs -0 sed -i '' "s/<Feature Name>/$PROJECT_NAME/g"
# Update first PRD title with project name (best effort)
if [[ -f specs/10-requirements/PRD-001.md ]]; then
sed -i '' "s/title: <Feature Name>/title: ${PROJECT_NAME}/" specs/10-requirements/PRD-001.md || true
fi
git add .
git commit -m "chore: bootstrap $PROJECT_NAME from template" >/dev/null
echo "✅ New project initialized: $TARGET_DIR"
echo "Next steps:"
echo "1) cd '$TARGET_DIR'"
echo "2) edit specs/10-requirements/PRD-001.md"
echo "3) set status: approved for ready specs"
echo "4) start first task from tasks/TASK-001.md"