-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinit-project.sh
More file actions
executable file
·54 lines (40 loc) · 1.12 KB
/
Copy pathinit-project.sh
File metadata and controls
executable file
·54 lines (40 loc) · 1.12 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
49
50
51
52
53
54
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/scripts/lib.sh"
usage() {
printf "Usage:\n %s [project-path]\n" "$0"
}
runner_root="$SCRIPT_DIR"
arg_path=""
if [[ "$#" -ge 1 ]]; then
arg_path="$1"
fi
project_path="$(resolve_project_path "$runner_root" "$arg_path" usage)"
project_abs="$(cd "$project_path" && pwd)"
plans_src="$runner_root/templates/PLANS.md"
if [[ ! -f "$plans_src" ]]; then
log_error "Missing template: $plans_src"
exit 1
fi
agent_dir="$project_abs/.agent"
execplans_dir="$agent_dir/execplans"
plans_dest="$agent_dir/PLANS.md"
plan_dest="$execplans_dir/execplan.md"
mkdir -p "$execplans_dir"
if [[ -f "$plans_dest" ]]; then
log_info "PLANS.md already exists at $plans_dest"
else
cp "$plans_src" "$plans_dest"
log_info "Created $plans_dest"
fi
if [[ -f "$plan_dest" ]]; then
log_info "ExecPlan already exists at $plan_dest"
else
cat > "$plan_dest" <<'EOF'
# <Project goal>
Maintained according to: .agent/PLANS.md
EOF
log_info "Created $plan_dest"
fi
log_info "Edit the ExecPlan, then run ./run-ralph.sh \"$project_abs\""