@thedecipherist/mdd 1.3.2 → 1.3.3
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/commands/mdd-branch-guard.sh +16 -13
- package/package.json +1 -1
|
@@ -13,26 +13,29 @@ BRANCH=$(git branch --show-current 2>/dev/null)
|
|
|
13
13
|
# Only block on main/master
|
|
14
14
|
[[ "$BRANCH" == "main" || "$BRANCH" == "master" ]] || exit 0
|
|
15
15
|
|
|
16
|
-
#
|
|
16
|
+
# Check for uncommitted changes
|
|
17
17
|
CHANGES=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
|
|
18
18
|
|
|
19
|
+
# Clean working tree — auto-create a branch and allow the write
|
|
20
|
+
if [ "$CHANGES" -eq 0 ]; then
|
|
21
|
+
AUTO_BRANCH="mdd/session-$(date +%Y%m%d-%H%M%S)"
|
|
22
|
+
git checkout -b "$AUTO_BRANCH" 2>/dev/null
|
|
23
|
+
echo ""
|
|
24
|
+
echo " MDD Branch Guard: auto-created branch '${AUTO_BRANCH}' (was on ${BRANCH})"
|
|
25
|
+
echo ""
|
|
26
|
+
exit 0
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# Dirty working tree — block to prevent losing work
|
|
19
30
|
echo ""
|
|
20
31
|
echo "⛔ MDD BRANCH GUARD"
|
|
21
32
|
echo ""
|
|
22
33
|
echo " File modification is blocked on branch '${BRANCH}'."
|
|
23
|
-
echo "
|
|
34
|
+
echo " You have ${CHANGES} uncommitted change(s). Commit or stash first:"
|
|
24
35
|
echo ""
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
echo " git add -A && git commit -m 'wip: ...' && git checkout -b feat/<name>"
|
|
29
|
-
echo " — or —"
|
|
30
|
-
echo " git stash && git checkout -b feat/<name>"
|
|
31
|
-
else
|
|
32
|
-
echo " Create a feature branch, then re-run your /mdd command:"
|
|
33
|
-
echo ""
|
|
34
|
-
echo " git checkout -b feat/<feature-name>"
|
|
35
|
-
fi
|
|
36
|
+
echo " git add -A && git commit -m 'wip: ...' && git checkout -b feat/<name>"
|
|
37
|
+
echo " — or —"
|
|
38
|
+
echo " git stash && git checkout -b feat/<name>"
|
|
36
39
|
echo ""
|
|
37
40
|
|
|
38
41
|
exit 2
|