spec-and-loop 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/ralph-run.sh +35 -6
package/package.json
CHANGED
package/scripts/ralph-run.sh
CHANGED
|
@@ -550,7 +550,7 @@ sync_tasks_to_ralph() {
|
|
|
550
550
|
local ralph_dir="$2"
|
|
551
551
|
|
|
552
552
|
local tasks_file="$change_dir/tasks.md"
|
|
553
|
-
local ralph_tasks_file="
|
|
553
|
+
local ralph_tasks_file="$ralph_dir/ralph-tasks.md"
|
|
554
554
|
local old_ralph_tasks_file="$change_dir/.ralph/ralph-tasks.md"
|
|
555
555
|
|
|
556
556
|
if [[ ! -f "$tasks_file" ]]; then
|
|
@@ -558,7 +558,23 @@ sync_tasks_to_ralph() {
|
|
|
558
558
|
return 1
|
|
559
559
|
fi
|
|
560
560
|
|
|
561
|
-
|
|
561
|
+
# Ensure the ralph directory exists
|
|
562
|
+
if [[ ! -d "$ralph_dir" ]]; then
|
|
563
|
+
mkdir -p "$ralph_dir"
|
|
564
|
+
log_verbose "Created ralph dir: $ralph_dir"
|
|
565
|
+
fi
|
|
566
|
+
|
|
567
|
+
# Resolve absolute path to tasks file (portable across Linux/macOS)
|
|
568
|
+
local abs_tasks_file=""
|
|
569
|
+
if command -v realpath >/dev/null 2>&1; then
|
|
570
|
+
abs_tasks_file=$(realpath "$tasks_file" 2>/dev/null || true)
|
|
571
|
+
elif readlink -f / >/dev/null 2>&1; then
|
|
572
|
+
abs_tasks_file=$(readlink -f "$tasks_file" 2>/dev/null || true)
|
|
573
|
+
else
|
|
574
|
+
local _tdir
|
|
575
|
+
_tdir=$(cd "$(dirname "$tasks_file")" 2>/dev/null && pwd -P || echo "")
|
|
576
|
+
abs_tasks_file="$_tdir/$(basename "$tasks_file")"
|
|
577
|
+
fi
|
|
562
578
|
|
|
563
579
|
# Clean up old Ralph tasks file in change directory if exists
|
|
564
580
|
if [[ -f "$old_ralph_tasks_file" ]]; then
|
|
@@ -567,10 +583,23 @@ sync_tasks_to_ralph() {
|
|
|
567
583
|
fi
|
|
568
584
|
|
|
569
585
|
# Use symlink so Ralph and openspec-apply-change work on the SAME file
|
|
586
|
+
# Ensure parent directory for ralph_tasks_file exists
|
|
587
|
+
mkdir -p "$(dirname "$ralph_tasks_file")"
|
|
588
|
+
|
|
570
589
|
if [[ -L "$ralph_tasks_file" ]]; then
|
|
571
590
|
log_verbose "Symlink exists, ensuring it points to correct location"
|
|
572
|
-
local current_target
|
|
573
|
-
|
|
591
|
+
local current_target=""
|
|
592
|
+
if command -v realpath >/dev/null 2>&1; then
|
|
593
|
+
current_target=$(realpath "$ralph_tasks_file" 2>/dev/null || echo "")
|
|
594
|
+
elif readlink -f / >/dev/null 2>&1; then
|
|
595
|
+
current_target=$(readlink -f "$ralph_tasks_file" 2>/dev/null || echo "")
|
|
596
|
+
else
|
|
597
|
+
current_target=$(readlink "$ralph_tasks_file" 2>/dev/null || echo "")
|
|
598
|
+
if [[ -n "$current_target" && "$current_target" != /* ]]; then
|
|
599
|
+
current_target="$(cd "$(dirname "$ralph_tasks_file")" && pwd -P)/$current_target"
|
|
600
|
+
fi
|
|
601
|
+
fi
|
|
602
|
+
|
|
574
603
|
if [[ "$current_target" != "$abs_tasks_file" ]]; then
|
|
575
604
|
log_verbose "Updating symlink to point to new change directory"
|
|
576
605
|
ln -sf "$abs_tasks_file" "$ralph_tasks_file"
|
|
@@ -578,11 +607,11 @@ sync_tasks_to_ralph() {
|
|
|
578
607
|
elif [[ -f "$ralph_tasks_file" ]]; then
|
|
579
608
|
# File exists but is not a symlink - replace with symlink
|
|
580
609
|
log_verbose "Replacing regular file with symlink to openspec tasks..."
|
|
581
|
-
rm "$ralph_tasks_file"
|
|
610
|
+
rm -f "$ralph_tasks_file"
|
|
582
611
|
ln -sf "$abs_tasks_file" "$ralph_tasks_file"
|
|
583
612
|
else
|
|
584
613
|
# No file exists - create new symlink
|
|
585
|
-
log_verbose "Creating symlink from
|
|
614
|
+
log_verbose "Creating symlink from $ralph_tasks_file to openspec tasks..."
|
|
586
615
|
ln -sf "$abs_tasks_file" "$ralph_tasks_file"
|
|
587
616
|
fi
|
|
588
617
|
|