ralph-teams 1.0.13 → 1.0.15
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/.claude/settings.local.json +31 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/ralph.sh +38 -39
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(git init:*)",
|
|
5
|
+
"Bash(jq:*)",
|
|
6
|
+
"Bash(./ralph.sh prd.json 2>&1 | head -30)",
|
|
7
|
+
"Bash(ls:*)",
|
|
8
|
+
"Bash(kill:*)",
|
|
9
|
+
"Bash(cat:*)",
|
|
10
|
+
"Bash(claude:*)",
|
|
11
|
+
"Bash(pkill:*)",
|
|
12
|
+
"mcp__Multi-CLI__List-Codex-Models",
|
|
13
|
+
"mcp__Multi-CLI__Ask-Codex",
|
|
14
|
+
"Bash(wc:*)",
|
|
15
|
+
"Bash(chmod:*)",
|
|
16
|
+
"Bash(gh copilot:*)",
|
|
17
|
+
"WebSearch",
|
|
18
|
+
"WebFetch(domain:docs.github.com)",
|
|
19
|
+
"WebFetch(domain:deepwiki.com)",
|
|
20
|
+
"Bash(ralph-claude:*)",
|
|
21
|
+
"Bash(npm run:*)",
|
|
22
|
+
"Bash(code:*)",
|
|
23
|
+
"Bash(npm link:*)",
|
|
24
|
+
"Bash(ralph-teams:*)",
|
|
25
|
+
"Bash(rjq validate:*)",
|
|
26
|
+
"Bash(rjq extract-stream-text:*)",
|
|
27
|
+
"Bash(rjq read:*)",
|
|
28
|
+
"Bash(npm test:*)"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
package/README.md
CHANGED
|
@@ -558,7 +558,7 @@ npm install -g ralph-teams
|
|
|
558
558
|
|
|
559
559
|
### Ralph needs to switch branches but the worktree is dirty
|
|
560
560
|
|
|
561
|
-
Ralph
|
|
561
|
+
Ralph auto-commits current changes before creating or switching to the loop branch. If you do not want that commit, clean up the worktree yourself before starting the run.
|
|
562
562
|
|
|
563
563
|
## Development
|
|
564
564
|
|
package/package.json
CHANGED
package/ralph.sh
CHANGED
|
@@ -407,41 +407,38 @@ prompt_to_commit_dirty_worktree() {
|
|
|
407
407
|
echo "Worktree has uncommitted changes and Ralph needs to create or switch to branch '$target_branch'."
|
|
408
408
|
echo "Ralph will now stage and commit all current changes before the run."
|
|
409
409
|
git status --short
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
local response
|
|
413
|
-
IFS= read -r response || response=""
|
|
414
|
-
case "$response" in
|
|
415
|
-
y|Y|yes|YES)
|
|
416
|
-
git add -A
|
|
417
|
-
git commit -m "chore: auto-commit changes before ralph run"
|
|
418
|
-
;;
|
|
419
|
-
*)
|
|
420
|
-
echo "Aborted: user declined auto-commit before run."
|
|
421
|
-
exit 1
|
|
422
|
-
;;
|
|
423
|
-
esac
|
|
410
|
+
git add -A
|
|
411
|
+
git commit -m "chore: auto-commit changes before ralph run"
|
|
424
412
|
}
|
|
425
413
|
|
|
426
|
-
|
|
414
|
+
auto_remove_stale_worktree_dir() {
|
|
427
415
|
local worktree_path="$1"
|
|
428
416
|
local branch_name="$2"
|
|
429
417
|
|
|
430
418
|
echo "Found a stale worktree directory at '$worktree_path' for branch '$branch_name'." >&2
|
|
431
419
|
echo "Git does not recognize it as an active worktree, but the directory still exists on disk." >&2
|
|
432
|
-
|
|
420
|
+
echo "Removing the stale directory so Ralph can recreate the worktree." >&2
|
|
421
|
+
rm -rf "$worktree_path"
|
|
422
|
+
}
|
|
433
423
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
424
|
+
cleanup_epic_worktree_artifacts() {
|
|
425
|
+
local worktree_path="$1"
|
|
426
|
+
local branch_name="$2"
|
|
427
|
+
|
|
428
|
+
# Prune stale git worktree metadata before cleanup.
|
|
429
|
+
git worktree prune >/dev/null 2>&1 || true
|
|
430
|
+
|
|
431
|
+
# Remove stale worktree entry if it exists.
|
|
432
|
+
git worktree remove "$worktree_path" --force >/dev/null 2>&1 || true
|
|
433
|
+
|
|
434
|
+
# If Git no longer knows about the worktree but the directory is still on disk,
|
|
435
|
+
# remove the stale directory so a fresh worktree can be created.
|
|
436
|
+
if [ -d "$worktree_path" ]; then
|
|
437
|
+
auto_remove_stale_worktree_dir "$worktree_path" "$branch_name"
|
|
438
|
+
fi
|
|
439
|
+
|
|
440
|
+
# Remove a leftover branch from a partial worktree-add attempt.
|
|
441
|
+
git branch -D "$branch_name" >/dev/null 2>&1 || true
|
|
445
442
|
}
|
|
446
443
|
|
|
447
444
|
# --- Ensure loop branch exists and is checked out ---
|
|
@@ -472,28 +469,30 @@ create_epic_worktree() {
|
|
|
472
469
|
local epic_id="$1"
|
|
473
470
|
local branch_name="ralph/${epic_id}"
|
|
474
471
|
local worktree_path="${RALPH_RUNTIME_DIRNAME}/.worktrees/${epic_id}"
|
|
472
|
+
local add_output
|
|
473
|
+
local retry_output
|
|
475
474
|
|
|
476
475
|
# Reuse existing worktree if it is already registered and present on disk
|
|
477
|
-
if [ -d "$worktree_path" ] && git worktree list | grep -
|
|
476
|
+
if [ -d "$worktree_path" ] && git worktree list | grep -Fq "$worktree_path"; then
|
|
478
477
|
echo "$worktree_path"
|
|
479
478
|
return
|
|
480
479
|
fi
|
|
481
480
|
|
|
482
|
-
|
|
483
|
-
git worktree prune >/dev/null 2>&1 || true
|
|
481
|
+
cleanup_epic_worktree_artifacts "$worktree_path" "$branch_name"
|
|
484
482
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
# ask before removing the stale directory so a fresh worktree can be created.
|
|
489
|
-
if [ -d "$worktree_path" ]; then
|
|
490
|
-
prompt_to_remove_stale_worktree_dir "$worktree_path" "$branch_name"
|
|
483
|
+
if add_output=$(git worktree add "$worktree_path" -b "$branch_name" "$LOOP_BRANCH" 2>&1 >/dev/null); then
|
|
484
|
+
echo "$worktree_path"
|
|
485
|
+
return
|
|
491
486
|
fi
|
|
492
|
-
# Remove stale branch if it exists
|
|
493
|
-
git branch -D "$branch_name" >/dev/null 2>&1 || true
|
|
494
487
|
|
|
495
|
-
|
|
488
|
+
echo "Worktree creation for '$branch_name' failed on the first attempt; pruning stale state and retrying once." >&2
|
|
489
|
+
[ -n "$add_output" ] && echo "$add_output" >&2
|
|
490
|
+
|
|
491
|
+
cleanup_epic_worktree_artifacts "$worktree_path" "$branch_name"
|
|
492
|
+
|
|
493
|
+
if ! retry_output=$(git worktree add "$worktree_path" -b "$branch_name" "$LOOP_BRANCH" 2>&1 >/dev/null); then
|
|
496
494
|
echo "Error: failed to create worktree $worktree_path for $branch_name" >&2
|
|
495
|
+
[ -n "$retry_output" ] && echo "$retry_output" >&2
|
|
497
496
|
exit 1
|
|
498
497
|
fi
|
|
499
498
|
echo "$worktree_path"
|