Skip to content

Commit 3d07c8b

Browse files
fix: remove --phase flag from merge-to-main.sh to prevent phase-name confusion (merge worktree-20260323-193735)
2 parents fb58ae9 + e9a0d12 commit 3d07c8b

File tree

6 files changed

+19
-40
lines changed

6 files changed

+19
-40
lines changed

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ After ExitPlanMode approval, do NOT begin implementation. Create a ticket epic (
148148
# Review uses autonomous resolution (2 fix/defend attempts before user escalation).
149149
# On attempt 2+, /dso:oscillation-check runs automatically if same files targeted.
150150
# 2. git push (or plugins/dso/scripts/merge-to-main.sh in worktree sessions — handles .claude/scripts/dso ticket sync + merge + push)
151-
# Supports phased execution: --phase=<name> (run one phase) or --resume (continue from last state file checkpoint).
151+
# Supports --resume (continue from last state file checkpoint).
152152
# Phases: sync → merge → validate → push → archive → ci_trigger
153153
# # REVIEW-DEFENSE: checkpoint_verify phase removed from docs here intentionally — story dso-q0df (batch 2) removes _phase_checkpoint_verify() from merge-to-main.sh. Docs lead code in this multi-story epic.
154154
# State file: /tmp/merge-to-main-state-<branch>.json (expires after 4h); lock file: /tmp/merge-to-main-lock-<hash>

plugins/dso/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dso",
3-
"version": "0.25.11",
3+
"version": "0.25.12",
44
"description": "Workflow infrastructure plugin for Claude Code projects",
55
"commands": "./commands/",
66
"skills": "./skills/",

plugins/dso/docs/WORKTREE-GUIDE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,15 +598,15 @@ ${CLAUDE_PLUGIN_ROOT}/scripts/merge-to-main.sh --resume
598598

599599
**Lock file**: `/tmp/merge-to-main-lock-<hash>` — prevents concurrent merge runs against the same repo. If a stale lock exists (process died), it is automatically broken on the next run.
600600

601-
### Running a Single Phase
601+
### Resuming After a Failure
602602

603-
To re-run one specific phase (e.g., after a partial failure):
603+
To resume from the last incomplete phase after a partial failure:
604604

605605
```bash
606-
${CLAUDE_PLUGIN_ROOT}/scripts/merge-to-main.sh --phase=push
606+
${CLAUDE_PLUGIN_ROOT}/scripts/merge-to-main.sh --resume
607607
```
608608

609-
Valid phase names: `sync`, `merge`, `validate`, `push`, `archive`, `ci_trigger`.
609+
The script records completed phases in a state file and resumes from the first incomplete one.
610610

611611
---
612612

plugins/dso/scripts/merge-to-main.sh

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ set -euo pipefail
1818
for _arg in "$@"; do
1919
if [[ "$_arg" == "--help" ]]; then
2020
cat <<'USAGE'
21-
Usage: merge-to-main.sh [--phase=<name>|--resume|--help]
21+
Usage: merge-to-main.sh [--resume|--help]
2222
23-
--phase=<name> Run a single named phase and exit. Valid phase names:
24-
sync merge validate push archive ci_trigger
2523
--resume Resume from last incomplete phase. On merge failure, squash-rebase
2624
recovery runs automatically before retrying (up to 5 retries).
2725
--help Print this usage message and exit.
2826
29-
(no args) Run all phases sequentially (backward compatible).
27+
(no args) Run all phases sequentially.
3028
3129
Merge recovery: on git merge failure the script squash-rebases the branch onto
3230
main and retries. If recovery fails, run --resume (retry budget: 5 attempts).
@@ -1274,14 +1272,10 @@ _phase_ci_trigger() {
12741272
_ALL_PHASES=(sync merge validate push archive ci_trigger)
12751273

12761274
# --- Parse CLI arguments ---
1277-
_CLI_PHASE=""
12781275
_CLI_RESUME=false
12791276

12801277
for _arg in "$@"; do
12811278
case "$_arg" in
1282-
--phase=*)
1283-
_CLI_PHASE="${_arg#--phase=}"
1284-
;;
12851279
--resume)
12861280
_CLI_RESUME=true
12871281
;;
@@ -1295,19 +1289,6 @@ for _arg in "$@"; do
12951289
esac
12961290
done
12971291

1298-
# --- Dispatch: --phase=<name> ---
1299-
if [[ -n "$_CLI_PHASE" ]]; then
1300-
_DISPATCH_FN="_phase_${_CLI_PHASE}"
1301-
if declare -f "$_DISPATCH_FN" > /dev/null 2>&1; then
1302-
"$_DISPATCH_FN"
1303-
echo "DONE: phase '$_CLI_PHASE' completed."
1304-
exit 0
1305-
else
1306-
echo "ERROR: Unknown phase '$_CLI_PHASE'. Valid phases: ${_ALL_PHASES[*]}" >&2
1307-
exit 1
1308-
fi
1309-
fi
1310-
13111292
# --- Dispatch: --resume ---
13121293
if [[ "$_CLI_RESUME" == "true" ]]; then
13131294
_sf=$(_state_file_path)
@@ -1418,8 +1399,8 @@ fi
14181399

14191400
# --- No-args (or state file missing for --resume): run all phases sequentially ---
14201401
if [[ $# -eq 0 ]]; then
1421-
echo "WARNING: Running all phases sequentially. Use --phase=<name> to run a single phase" \
1422-
"or --resume to continue from the last incomplete phase." >&2
1402+
echo "Running all phases sequentially. Use --resume to continue from the last" \
1403+
"incomplete phase if interrupted." >&2
14231404
fi
14241405

14251406
_phase_sync

tests/hooks/test-merge-to-main-portability.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ assert_contains "test_portability_baseline_skip_info" \
172172
assert_contains "test_portability_ci_skip_info" \
173173
"INFO: merge.ci_workflow_name not configured" "$MERGE_OUTPUT1"
174174

175-
# WARNING for no-args sequential run must appear — merge-to-main.sh always emits
176-
# this when invoked with no arguments (the normal single-step usage pattern).
177-
assert_contains "test_portability_noargs_warning_present" \
178-
"WARNING: Running all phases sequentially" "$MERGE_OUTPUT1"
175+
# Info message for no-args sequential run must appear — merge-to-main.sh always
176+
# emits this when invoked with no arguments (the normal single-step usage pattern).
177+
assert_contains "test_portability_noargs_message_present" \
178+
"Running all phases sequentially" "$MERGE_OUTPUT1"
179179

180180
cleanup_env "$TMPENV1"
181181

tests/scripts/test-merge-to-main.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -642,10 +642,10 @@ HAS_HELP_PHASE=$(grep -c 'phase' "$MERGE_SCRIPT" || true)
642642
assert_ne "test_cli_help_output_contains_phase" "0" "$HAS_HELP_PHASE"
643643

644644
# =============================================================================
645-
# Test: --phase argument is parsed in the script
645+
# Test: --phase argument has been removed from the script
646646
# =============================================================================
647647
HAS_PHASE_ARG=$(grep -c '\-\-phase' "$MERGE_SCRIPT" || true)
648-
assert_ne "test_cli_phase_arg_handled" "0" "$HAS_PHASE_ARG"
648+
assert_eq "test_cli_phase_arg_removed" "0" "$HAS_PHASE_ARG"
649649

650650
# =============================================================================
651651
# Test: --resume argument is parsed in the script
@@ -676,12 +676,10 @@ assert_eq "test_cli_help_output_mentions_phase" "true" "$_HELP_HAS_PHASE"
676676
assert_eq "test_cli_help_exits_0" "0" "$_HELP_RC"
677677

678678
# =============================================================================
679-
# Test: --phase=<name> dispatches a single named phase and exits
680-
# We use a no-op phase by checking that passing --phase=push invokes _phase_push
681-
# via structural check (arg parsing dispatches _phase_$name)
679+
# Test: --phase flag has been removed (agents should use --resume instead)
682680
# =============================================================================
683-
HAS_PHASE_DISPATCH=$(grep -cE '_phase_\$|_phase_.*\$\{.*\}|"_phase_\$' "$MERGE_SCRIPT" || true)
684-
assert_ne "test_cli_phase_dispatches_function" "0" "$HAS_PHASE_DISPATCH"
681+
HAS_PHASE_FLAG=$(grep -c '\-\-phase=' "$MERGE_SCRIPT" || true)
682+
assert_eq "test_cli_phase_flag_removed" "0" "$HAS_PHASE_FLAG"
685683

686684
# =============================================================================
687685
# Test: --resume reads state file (structural: script uses completed_phases or _state_is_fresh)

0 commit comments

Comments
 (0)