@atlashub/smartstack-cli 1.13.1 → 1.14.0
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/.documentation/agents.html +1 -1
- package/.documentation/apex.html +1 -1
- package/.documentation/business-analyse.html +1 -1
- package/.documentation/cli-commands.html +3 -3
- package/.documentation/commands.html +1 -1
- package/.documentation/efcore.html +1 -1
- package/.documentation/gitflow.html +1 -1
- package/.documentation/hooks.html +1 -1
- package/.documentation/index.html +1 -1
- package/.documentation/init.html +3 -3
- package/.documentation/installation.html +1001 -352
- package/.documentation/ralph-loop.html +1 -1
- package/.documentation/test-web.html +1 -1
- package/README.md +88 -20
- package/dist/index.js +276 -85
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/agents/code-reviewer.md +163 -0
- package/templates/agents/efcore/db-deploy.md +25 -7
- package/templates/agents/efcore/db-reset.md +31 -10
- package/templates/agents/efcore/db-status.md +22 -5
- package/templates/agents/efcore/migration.md +69 -19
- package/templates/agents/gitflow/cleanup.md +8 -1
- package/templates/agents/gitflow/commit.md +7 -5
- package/templates/agents/gitflow/finish.md +6 -4
- package/templates/agents/gitflow/pr.md +8 -1
- package/templates/agents/gitflow/start.md +1 -1
- package/templates/commands/check-version.md +267 -0
- package/templates/commands/efcore/_shared.md +30 -1
- package/templates/commands/efcore/db-reset.md +18 -6
- package/templates/commands/gitflow/OPTIMIZATIONS.md +206 -0
- package/templates/commands/refactor.md +164 -0
- package/templates/project/DependencyInjection.Application.cs.template +25 -0
- package/templates/project/DependencyInjection.Infrastructure.cs.template +61 -0
- package/templates/project/DesignTimeExtensionsDbContextFactory.cs.template +70 -0
- package/templates/project/ExampleEntity.cs.template +116 -0
- package/templates/project/ExampleEntityConfiguration.cs.template +64 -0
- package/templates/project/ExampleService.cs.template +146 -0
- package/templates/project/ExtensionsDbContext.cs.template +41 -0
- package/templates/project/IExtensionsDbContext.cs.template +22 -0
- package/templates/project/Program.cs.template +47 -0
- package/templates/project/README.md +79 -0
- package/templates/ralph/README.md +10 -8
- package/templates/ralph/ralph.config.yaml +2 -2
- package/templates/skills/_shared.md +44 -44
- package/templates/skills/ai-prompt/SKILL.md +55 -55
- package/templates/skills/apex/SKILL.md +235 -0
- package/templates/skills/apex/steps/step-00-init.md +203 -0
- package/templates/skills/apex/steps/step-01-analyze.md +210 -0
- package/templates/skills/apex/steps/step-02-plan.md +217 -0
- package/templates/skills/apex/steps/step-03-execute.md +178 -0
- package/templates/skills/apex/steps/step-04-validate.md +217 -0
- package/templates/skills/apex/steps/step-05-examine.md +207 -0
- package/templates/skills/apex/steps/step-06-resolve.md +181 -0
- package/templates/skills/apex/steps/step-07-tests.md +206 -0
- package/templates/skills/apex/steps/step-08-run-tests.md +207 -0
- package/templates/skills/apex/templates/00-context.md +46 -0
- package/templates/skills/apex/templates/01-analyze.md +63 -0
- package/templates/skills/apex/templates/02-plan.md +63 -0
- package/templates/skills/apex/templates/03-execute.md +34 -0
- package/templates/skills/apex/templates/04-validate.md +61 -0
- package/templates/skills/apex/templates/05-examine.md +58 -0
- package/templates/skills/apex/templates/06-resolve.md +39 -0
- package/templates/skills/apex/templates/07-tests.md +56 -0
- package/templates/skills/apex/templates/08-run-tests.md +41 -0
- package/templates/skills/apex/templates/README.md +69 -0
- package/templates/skills/application/SKILL.md +50 -50
- package/templates/skills/application/templates-backend.md +25 -25
- package/templates/skills/application/templates-frontend.md +43 -43
- package/templates/skills/application/templates-i18n.md +29 -29
- package/templates/skills/application/templates-seed.md +77 -77
- package/templates/skills/business-analyse/SKILL.md +223 -0
- package/templates/skills/business-analyse/_shared.md +258 -0
- package/templates/skills/business-analyse/questionnaire/01-context.md +33 -0
- package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +35 -0
- package/templates/skills/business-analyse/questionnaire/03-scope.md +35 -0
- package/templates/skills/business-analyse/questionnaire/04-data.md +36 -0
- package/templates/skills/business-analyse/questionnaire/05-integrations.md +36 -0
- package/templates/skills/business-analyse/questionnaire/06-security.md +40 -0
- package/templates/skills/business-analyse/questionnaire/07-ui.md +36 -0
- package/templates/skills/business-analyse/questionnaire/08-performance.md +35 -0
- package/templates/skills/business-analyse/questionnaire/09-constraints.md +35 -0
- package/templates/skills/business-analyse/questionnaire/10-documentation.md +35 -0
- package/templates/skills/business-analyse/questionnaire.md +177 -177
- package/templates/skills/business-analyse/react/components.md +340 -0
- package/templates/skills/business-analyse/react/i18n-template.md +245 -0
- package/templates/skills/business-analyse/react/schema.md +151 -0
- package/templates/skills/business-analyse/steps/step-00-init.md +293 -0
- package/templates/skills/business-analyse/steps/step-01-discover.md +267 -0
- package/templates/skills/business-analyse/steps/step-02-analyse.md +243 -0
- package/templates/skills/business-analyse/steps/step-03-specify.md +317 -0
- package/templates/skills/business-analyse/steps/step-04-validate.md +239 -0
- package/templates/skills/business-analyse/steps/step-05-handoff.md +336 -0
- package/templates/skills/business-analyse/steps/step-06-doc-html.md +261 -0
- package/templates/skills/business-analyse/templates/00-context.md +105 -0
- package/templates/skills/business-analyse/templates/frd-brd.md +97 -0
- package/templates/skills/business-analyse/templates/frd-discovery.md +78 -0
- package/templates/skills/business-analyse/templates/frd-handoff.md +118 -0
- package/templates/skills/business-analyse/templates/frd-spec.md +168 -0
- package/templates/skills/business-analyse/templates-frd.md +217 -217
- package/templates/skills/business-analyse/templates-react.md +26 -26
- package/templates/skills/controller/SKILL.md +141 -92
- package/templates/skills/controller/postman-templates.md +15 -15
- package/templates/skills/controller/steps/step-00-init.md +191 -0
- package/templates/skills/controller/steps/step-01-analyze.md +146 -0
- package/templates/skills/controller/steps/step-02-plan.md +176 -0
- package/templates/skills/controller/steps/step-03-generate.md +219 -0
- package/templates/skills/controller/steps/step-04-perms.md +219 -0
- package/templates/skills/controller/steps/step-05-validate.md +107 -0
- package/templates/skills/controller/templates.md +77 -77
- package/templates/skills/documentation/SKILL.md +79 -79
- package/templates/skills/feature-full/SKILL.md +38 -38
- package/templates/skills/gitflow/SKILL.md +277 -0
- package/templates/{commands → skills}/gitflow/_shared.md +20 -20
- package/templates/skills/gitflow/phases/abort.md +173 -0
- package/templates/skills/gitflow/phases/cleanup.md +226 -0
- package/templates/skills/gitflow/phases/status.md +178 -0
- package/templates/skills/gitflow/steps/step-commit.md +255 -0
- package/templates/skills/gitflow/steps/step-finish.md +255 -0
- package/templates/skills/gitflow/steps/step-init.md +209 -0
- package/templates/skills/gitflow/steps/step-merge.md +225 -0
- package/templates/skills/gitflow/steps/step-plan.md +208 -0
- package/templates/skills/gitflow/steps/step-pr.md +235 -0
- package/templates/skills/gitflow/steps/step-start.md +234 -0
- package/templates/skills/gitflow/steps/step-sync.md +200 -0
- package/templates/skills/gitflow/templates/config.json +53 -0
- package/templates/skills/notification/SKILL.md +51 -51
- package/templates/skills/ralph-loop/SKILL.md +228 -0
- package/templates/skills/ralph-loop/steps/step-00-init.md +201 -0
- package/templates/skills/ralph-loop/steps/step-01-task.md +169 -0
- package/templates/skills/ralph-loop/steps/step-02-execute.md +173 -0
- package/templates/skills/ralph-loop/steps/step-03-commit.md +170 -0
- package/templates/skills/ralph-loop/steps/step-04-check.md +162 -0
- package/templates/skills/ralph-loop/steps/step-05-report.md +181 -0
- package/templates/skills/review-code/SKILL.md +219 -0
- package/templates/skills/review-code/references/clean-code-principles.md +140 -0
- package/templates/skills/review-code/references/code-quality-metrics.md +174 -0
- package/templates/skills/review-code/references/feedback-patterns.md +149 -0
- package/templates/skills/review-code/references/security-checklist.md +127 -0
- package/templates/skills/ui-components/SKILL.md +54 -54
- package/templates/skills/workflow/SKILL.md +46 -46
- package/templates/commands/ai-prompt.md +0 -315
- package/templates/commands/apex/1-analyze.md +0 -100
- package/templates/commands/apex/2-plan.md +0 -145
- package/templates/commands/apex/3-execute.md +0 -171
- package/templates/commands/apex/4-examine.md +0 -116
- package/templates/commands/apex/5-tasks.md +0 -209
- package/templates/commands/apex.md +0 -76
- package/templates/commands/application/create.md +0 -362
- package/templates/commands/application/templates-backend.md +0 -463
- package/templates/commands/application/templates-frontend.md +0 -517
- package/templates/commands/application/templates-i18n.md +0 -478
- package/templates/commands/application/templates-seed.md +0 -362
- package/templates/commands/application.md +0 -303
- package/templates/commands/business-analyse/0-orchestrate.md +0 -156
- package/templates/commands/business-analyse/1-init.md +0 -99
- package/templates/commands/business-analyse/2-discover.md +0 -143
- package/templates/commands/business-analyse/3-analyse.md +0 -106
- package/templates/commands/business-analyse/4-specify.md +0 -133
- package/templates/commands/business-analyse/5-validate.md +0 -132
- package/templates/commands/business-analyse/6-handoff.md +0 -157
- package/templates/commands/business-analyse/7-doc-html.md +0 -103
- package/templates/commands/business-analyse/_shared.md +0 -176
- package/templates/commands/business-analyse/bug.md +0 -118
- package/templates/commands/business-analyse/change-request.md +0 -144
- package/templates/commands/business-analyse/hotfix.md +0 -116
- package/templates/commands/business-analyse.md +0 -121
- package/templates/commands/controller/create.md +0 -216
- package/templates/commands/controller/postman-templates.md +0 -528
- package/templates/commands/controller/templates.md +0 -600
- package/templates/commands/controller.md +0 -337
- package/templates/commands/create/agent.md +0 -138
- package/templates/commands/create/command.md +0 -166
- package/templates/commands/create/hook.md +0 -234
- package/templates/commands/create/plugin.md +0 -329
- package/templates/commands/create/project.md +0 -508
- package/templates/commands/create/skill.md +0 -199
- package/templates/commands/create.md +0 -220
- package/templates/commands/documentation/module.md +0 -202
- package/templates/commands/documentation/templates.md +0 -432
- package/templates/commands/documentation.md +0 -190
- package/templates/commands/epct.md +0 -69
- package/templates/commands/explain.md +0 -186
- package/templates/commands/feature-full.md +0 -267
- package/templates/commands/gitflow/1-init.md +0 -188
- package/templates/commands/gitflow/10-start.md +0 -190
- package/templates/commands/gitflow/11-finish.md +0 -382
- package/templates/commands/gitflow/12-cleanup.md +0 -103
- package/templates/commands/gitflow/13-sync.md +0 -216
- package/templates/commands/gitflow/14-rebase.md +0 -251
- package/templates/commands/gitflow/2-status.md +0 -122
- package/templates/commands/gitflow/3-commit.md +0 -209
- package/templates/commands/gitflow/4-plan.md +0 -174
- package/templates/commands/gitflow/5-exec.md +0 -202
- package/templates/commands/gitflow/6-abort.md +0 -121
- package/templates/commands/gitflow/7-pull-request.md +0 -176
- package/templates/commands/gitflow/8-review.md +0 -113
- package/templates/commands/gitflow/9-merge.md +0 -157
- package/templates/commands/gitflow.md +0 -128
- package/templates/commands/implement.md +0 -663
- package/templates/commands/init.md +0 -567
- package/templates/commands/mcp-integration.md +0 -330
- package/templates/commands/notification.md +0 -129
- package/templates/commands/oneshot.md +0 -57
- package/templates/commands/quickstart.md +0 -154
- package/templates/commands/ralph-loop/cancel-ralph.md +0 -18
- package/templates/commands/ralph-loop/help.md +0 -126
- package/templates/commands/ralph-loop/ralph-loop.md +0 -120
- package/templates/commands/review.md +0 -106
- package/templates/commands/workflow.md +0 -193
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: abort
|
|
3
|
+
description: Rollback and recovery operations
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Phase: ABORT - Rollback & Recovery
|
|
7
|
+
|
|
8
|
+
## YOUR TASK:
|
|
9
|
+
|
|
10
|
+
Provide rollback and recovery options for GitFlow operations.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## OPTIONS:
|
|
15
|
+
|
|
16
|
+
```yaml
|
|
17
|
+
AskUserQuestion:
|
|
18
|
+
header: "Recovery"
|
|
19
|
+
question: "What do you want to abort/rollback?"
|
|
20
|
+
options:
|
|
21
|
+
- label: "Abort current merge/rebase"
|
|
22
|
+
description: "Cancel in-progress git operation"
|
|
23
|
+
- label: "Abandon current branch"
|
|
24
|
+
description: "Delete branch and worktree, return to develop"
|
|
25
|
+
- label: "Restore from checkpoint"
|
|
26
|
+
description: "Restore to a saved checkpoint"
|
|
27
|
+
- label: "Reset branch to remote"
|
|
28
|
+
description: "Discard local changes, match remote"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## EXECUTION:
|
|
34
|
+
|
|
35
|
+
### Option 1: Abort Merge/Rebase
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Check for in-progress operations
|
|
39
|
+
if [ -d ".git/rebase-merge" ] || [ -d ".git/rebase-apply" ]; then
|
|
40
|
+
echo "Aborting rebase..."
|
|
41
|
+
git rebase --abort
|
|
42
|
+
elif [ -f ".git/MERGE_HEAD" ]; then
|
|
43
|
+
echo "Aborting merge..."
|
|
44
|
+
git merge --abort
|
|
45
|
+
elif [ -f ".git/CHERRY_PICK_HEAD" ]; then
|
|
46
|
+
echo "Aborting cherry-pick..."
|
|
47
|
+
git cherry-pick --abort
|
|
48
|
+
else
|
|
49
|
+
echo "No operation in progress"
|
|
50
|
+
fi
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Option 2: Abandon Branch
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
CURRENT=$(git rev-parse --abbrev-ref HEAD)
|
|
57
|
+
BRANCH_TYPE=$(echo $CURRENT | cut -d'/' -f1)
|
|
58
|
+
|
|
59
|
+
# Confirm
|
|
60
|
+
echo "⚠️ This will delete branch $CURRENT and its worktree"
|
|
61
|
+
echo "All uncommitted changes will be LOST"
|
|
62
|
+
|
|
63
|
+
# Find worktree
|
|
64
|
+
WORKTREE=$(git worktree list | grep "$CURRENT" | awk '{print $1}')
|
|
65
|
+
|
|
66
|
+
# Create backup tag
|
|
67
|
+
BACKUP_TAG="backup/$CURRENT-$(date +%Y%m%d-%H%M%S)"
|
|
68
|
+
git tag "$BACKUP_TAG" HEAD
|
|
69
|
+
echo "✓ Backup created: $BACKUP_TAG"
|
|
70
|
+
|
|
71
|
+
# Switch to develop
|
|
72
|
+
git checkout develop
|
|
73
|
+
|
|
74
|
+
# Remove worktree
|
|
75
|
+
[ -n "$WORKTREE" ] && {
|
|
76
|
+
git worktree remove "$WORKTREE" --force
|
|
77
|
+
git worktree prune
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
# Delete branch
|
|
81
|
+
git branch -D "$CURRENT"
|
|
82
|
+
git push origin --delete "$CURRENT" 2>/dev/null
|
|
83
|
+
|
|
84
|
+
echo "✓ Branch $CURRENT abandoned"
|
|
85
|
+
echo " Backup: $BACKUP_TAG (use 'git checkout $BACKUP_TAG' to recover)"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Option 3: Restore from Checkpoint
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# List available checkpoints
|
|
92
|
+
CHECKPOINTS=$(ls -t .claude/gitflow/logs/checkpoint_*.json 2>/dev/null)
|
|
93
|
+
|
|
94
|
+
if [ -z "$CHECKPOINTS" ]; then
|
|
95
|
+
echo "No checkpoints found"
|
|
96
|
+
exit 1
|
|
97
|
+
fi
|
|
98
|
+
|
|
99
|
+
echo "Available checkpoints:"
|
|
100
|
+
for cp in $CHECKPOINTS; do
|
|
101
|
+
TIMESTAMP=$(grep -oP '"timestamp":\s*"\K[^"]+' "$cp")
|
|
102
|
+
BRANCH=$(grep -oP '"branch":\s*"\K[^"]+' "$cp")
|
|
103
|
+
COMMIT=$(grep -oP '"commit":\s*"\K[^"]+' "$cp")
|
|
104
|
+
echo " - $TIMESTAMP: $BRANCH @ $COMMIT"
|
|
105
|
+
done
|
|
106
|
+
|
|
107
|
+
# Select checkpoint
|
|
108
|
+
# ... user selection ...
|
|
109
|
+
|
|
110
|
+
# Restore
|
|
111
|
+
COMMIT=$(grep -oP '"commit":\s*"\K[^"]+' "$SELECTED_CHECKPOINT")
|
|
112
|
+
git reset --hard "$COMMIT"
|
|
113
|
+
echo "✓ Restored to $COMMIT"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Option 4: Reset to Remote
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
CURRENT=$(git rev-parse --abbrev-ref HEAD)
|
|
120
|
+
|
|
121
|
+
# Check for local changes
|
|
122
|
+
CHANGES=$(git status --porcelain | wc -l)
|
|
123
|
+
[ "$CHANGES" -gt 0 ] && {
|
|
124
|
+
echo "⚠️ $CHANGES uncommitted changes will be LOST"
|
|
125
|
+
# Confirm
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
# Stash as backup
|
|
129
|
+
git stash push -m "abort-backup-$(date +%s)" --include-untracked
|
|
130
|
+
|
|
131
|
+
# Reset to remote
|
|
132
|
+
git fetch origin
|
|
133
|
+
git reset --hard "origin/$CURRENT"
|
|
134
|
+
|
|
135
|
+
echo "✓ Reset to origin/$CURRENT"
|
|
136
|
+
echo " Backup in stash (use 'git stash list' to see)"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## SAFETY FEATURES:
|
|
142
|
+
|
|
143
|
+
1. **Backup tag** created before destructive operations
|
|
144
|
+
2. **Stash backup** before reset
|
|
145
|
+
3. **Checkpoint restore** for plan execution
|
|
146
|
+
4. **Confirmation required** for destructive actions
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## RECOVERY COMMANDS:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# List backup tags
|
|
154
|
+
git tag | grep "^backup/"
|
|
155
|
+
|
|
156
|
+
# Recover from backup
|
|
157
|
+
git checkout backup/{branch-name}
|
|
158
|
+
git checkout -b {new-branch-name}
|
|
159
|
+
|
|
160
|
+
# List stashes
|
|
161
|
+
git stash list
|
|
162
|
+
|
|
163
|
+
# Recover from stash
|
|
164
|
+
git stash pop
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## SUCCESS CRITERIA:
|
|
170
|
+
|
|
171
|
+
- Operation aborted cleanly
|
|
172
|
+
- Backup created before destructive action
|
|
173
|
+
- User returned to safe state (develop/main)
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cleanup
|
|
3
|
+
description: Audit and remove orphan worktrees and branches
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Phase: CLEANUP - Maintenance
|
|
7
|
+
|
|
8
|
+
## YOUR TASK:
|
|
9
|
+
|
|
10
|
+
Audit worktrees and branches, remove orphaned/stale items.
|
|
11
|
+
|
|
12
|
+
**IMPORTANT:** Must be run from main or develop branch.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## PRE-CHECK:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
CURRENT=$(git rev-parse --abbrev-ref HEAD)
|
|
20
|
+
|
|
21
|
+
[[ "$CURRENT" != "main" ]] && [[ "$CURRENT" != "develop" ]] && {
|
|
22
|
+
echo "❌ Cleanup must be run from main or develop"
|
|
23
|
+
echo " Current branch: $CURRENT"
|
|
24
|
+
echo "→ Run: git checkout develop"
|
|
25
|
+
STOP
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## EXECUTION:
|
|
32
|
+
|
|
33
|
+
### 1. Audit Worktrees
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
echo "Scanning worktrees..."
|
|
37
|
+
|
|
38
|
+
git worktree list > /tmp/worktrees.txt
|
|
39
|
+
|
|
40
|
+
ORPHANED=()
|
|
41
|
+
STALE=()
|
|
42
|
+
VALID=()
|
|
43
|
+
|
|
44
|
+
while read -r line; do
|
|
45
|
+
WT_PATH=$(echo "$line" | awk '{print $1}')
|
|
46
|
+
WT_COMMIT=$(echo "$line" | awk '{print $2}')
|
|
47
|
+
WT_BRANCH=$(echo "$line" | awk '{print $3}' | tr -d '[]')
|
|
48
|
+
|
|
49
|
+
# Check if path exists
|
|
50
|
+
if [ ! -d "$WT_PATH" ]; then
|
|
51
|
+
ORPHANED+=("$WT_PATH:$WT_BRANCH")
|
|
52
|
+
continue
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
# Check if branch still exists on remote
|
|
56
|
+
REMOTE_EXISTS=$(git branch -r --list "origin/$WT_BRANCH" | wc -l)
|
|
57
|
+
if [ "$REMOTE_EXISTS" -eq 0 ] && [[ "$WT_BRANCH" != "main" ]] && [[ "$WT_BRANCH" != "develop" ]]; then
|
|
58
|
+
STALE+=("$WT_PATH:$WT_BRANCH")
|
|
59
|
+
continue
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
VALID+=("$WT_PATH:$WT_BRANCH")
|
|
63
|
+
done < /tmp/worktrees.txt
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 2. Audit Local Branches
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
echo "Scanning local branches..."
|
|
70
|
+
|
|
71
|
+
MERGED_BRANCHES=()
|
|
72
|
+
UNMERGED_BRANCHES=()
|
|
73
|
+
|
|
74
|
+
# Find merged branches
|
|
75
|
+
for branch in $(git branch --merged develop | grep -v "^\*" | grep -v "main" | grep -v "develop"); do
|
|
76
|
+
# Check if remote exists
|
|
77
|
+
REMOTE_EXISTS=$(git branch -r --list "origin/$branch" | wc -l)
|
|
78
|
+
[ "$REMOTE_EXISTS" -eq 0 ] && MERGED_BRANCHES+=("$branch")
|
|
79
|
+
done
|
|
80
|
+
|
|
81
|
+
# Find branches without remote
|
|
82
|
+
for branch in $(git branch | grep -v "^\*" | grep -v "main" | grep -v "develop"); do
|
|
83
|
+
REMOTE_EXISTS=$(git branch -r --list "origin/$branch" | wc -l)
|
|
84
|
+
[ "$REMOTE_EXISTS" -eq 0 ] && {
|
|
85
|
+
MERGED=$(git branch --merged develop | grep -c "$branch")
|
|
86
|
+
[ "$MERGED" -eq 0 ] && UNMERGED_BRANCHES+=("$branch")
|
|
87
|
+
}
|
|
88
|
+
done
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 3. Display Audit Results
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
╔══════════════════════════════════════════════════════════════════╗
|
|
95
|
+
║ CLEANUP AUDIT ║
|
|
96
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
97
|
+
|
|
98
|
+
## Worktrees
|
|
99
|
+
|
|
100
|
+
| Status | Count |
|
|
101
|
+
|--------|-------|
|
|
102
|
+
| Valid | {#VALID} |
|
|
103
|
+
| Orphaned | {#ORPHANED} |
|
|
104
|
+
| Stale | {#STALE} |
|
|
105
|
+
|
|
106
|
+
{if ORPHANED}
|
|
107
|
+
### Orphaned Worktrees (path missing)
|
|
108
|
+
{list with paths}
|
|
109
|
+
{endif}
|
|
110
|
+
|
|
111
|
+
{if STALE}
|
|
112
|
+
### Stale Worktrees (remote deleted)
|
|
113
|
+
{list with paths and branches}
|
|
114
|
+
{endif}
|
|
115
|
+
|
|
116
|
+
## Local Branches
|
|
117
|
+
|
|
118
|
+
| Status | Count |
|
|
119
|
+
|--------|-------|
|
|
120
|
+
| Merged (safe to delete) | {#MERGED_BRANCHES} |
|
|
121
|
+
| Unmerged (caution) | {#UNMERGED_BRANCHES} |
|
|
122
|
+
|
|
123
|
+
{if MERGED_BRANCHES}
|
|
124
|
+
### Merged Branches
|
|
125
|
+
{list}
|
|
126
|
+
{endif}
|
|
127
|
+
|
|
128
|
+
{if UNMERGED_BRANCHES}
|
|
129
|
+
### Unmerged Branches ⚠️
|
|
130
|
+
{list}
|
|
131
|
+
{endif}
|
|
132
|
+
|
|
133
|
+
╚══════════════════════════════════════════════════════════════════╝
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### 4. Cleanup Actions
|
|
137
|
+
|
|
138
|
+
```yaml
|
|
139
|
+
AskUserQuestion:
|
|
140
|
+
header: "Cleanup"
|
|
141
|
+
question: "What do you want to clean?"
|
|
142
|
+
options:
|
|
143
|
+
- label: "All safe items (Recommended)"
|
|
144
|
+
description: "Orphaned worktrees + merged branches"
|
|
145
|
+
- label: "Worktrees only"
|
|
146
|
+
description: "Remove orphaned and stale worktrees"
|
|
147
|
+
- label: "Branches only"
|
|
148
|
+
description: "Delete merged local branches"
|
|
149
|
+
- label: "Nothing (dry run)"
|
|
150
|
+
description: "Just show what would be cleaned"
|
|
151
|
+
multiSelect: false
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 5. Execute Cleanup
|
|
155
|
+
|
|
156
|
+
**Worktrees:**
|
|
157
|
+
```bash
|
|
158
|
+
# Remove orphaned
|
|
159
|
+
for item in "${ORPHANED[@]}"; do
|
|
160
|
+
WT_PATH=$(echo "$item" | cut -d':' -f1)
|
|
161
|
+
git worktree remove "$WT_PATH" --force 2>/dev/null || rm -rf "$WT_PATH"
|
|
162
|
+
done
|
|
163
|
+
|
|
164
|
+
# Prune
|
|
165
|
+
git worktree prune
|
|
166
|
+
|
|
167
|
+
# Remove stale
|
|
168
|
+
for item in "${STALE[@]}"; do
|
|
169
|
+
WT_PATH=$(echo "$item" | cut -d':' -f1)
|
|
170
|
+
WT_BRANCH=$(echo "$item" | cut -d':' -f2)
|
|
171
|
+
|
|
172
|
+
git worktree remove "$WT_PATH" --force 2>/dev/null || rm -rf "$WT_PATH"
|
|
173
|
+
git branch -D "$WT_BRANCH" 2>/dev/null
|
|
174
|
+
done
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Branches:**
|
|
178
|
+
```bash
|
|
179
|
+
# Delete merged branches
|
|
180
|
+
for branch in "${MERGED_BRANCHES[@]}"; do
|
|
181
|
+
git branch -d "$branch"
|
|
182
|
+
done
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### 6. Summary
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
╔══════════════════════════════════════════════════════════════════╗
|
|
189
|
+
║ CLEANUP COMPLETE ║
|
|
190
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
191
|
+
║ Worktrees removed: {count} ║
|
|
192
|
+
║ Branches deleted: {count} ║
|
|
193
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
194
|
+
║ Remaining worktrees: {count} ║
|
|
195
|
+
║ Remaining branches: {count} ║
|
|
196
|
+
╚══════════════════════════════════════════════════════════════════╝
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## DRY RUN MODE:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# With --dry-run flag
|
|
205
|
+
echo "DRY RUN - No changes will be made"
|
|
206
|
+
echo ""
|
|
207
|
+
echo "Would remove worktrees:"
|
|
208
|
+
for item in "${ORPHANED[@]}" "${STALE[@]}"; do
|
|
209
|
+
echo " - $item"
|
|
210
|
+
done
|
|
211
|
+
echo ""
|
|
212
|
+
echo "Would delete branches:"
|
|
213
|
+
for branch in "${MERGED_BRANCHES[@]}"; do
|
|
214
|
+
echo " - $branch"
|
|
215
|
+
done
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## SUCCESS CRITERIA:
|
|
221
|
+
|
|
222
|
+
- Audit completed
|
|
223
|
+
- Orphaned worktrees removed
|
|
224
|
+
- Stale worktrees removed
|
|
225
|
+
- Merged branches deleted
|
|
226
|
+
- Summary displayed
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: status
|
|
3
|
+
description: Complete GitFlow state diagnostic
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Phase: STATUS - Diagnostic
|
|
7
|
+
|
|
8
|
+
## YOUR TASK:
|
|
9
|
+
|
|
10
|
+
Display complete GitFlow state including branches, worktrees, remotes, and pending work.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## EXECUTION:
|
|
15
|
+
|
|
16
|
+
### 1. Repository Info
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
REPO_NAME=$(basename $(git rev-parse --show-toplevel))
|
|
20
|
+
CURRENT=$(git rev-parse --abbrev-ref HEAD)
|
|
21
|
+
REMOTE_URL=$(git remote get-url origin 2>/dev/null || echo "No remote")
|
|
22
|
+
|
|
23
|
+
# Detect provider
|
|
24
|
+
[[ "$REMOTE_URL" == *"github.com"* ]] && GIT_PROVIDER="GitHub"
|
|
25
|
+
[[ "$REMOTE_URL" == *"dev.azure.com"* ]] && GIT_PROVIDER="Azure DevOps"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 2. Branch Status
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git fetch origin --quiet
|
|
32
|
+
|
|
33
|
+
# Main branches
|
|
34
|
+
MAIN_LOCAL=$(git rev-parse --short main 2>/dev/null || echo "N/A")
|
|
35
|
+
MAIN_REMOTE=$(git rev-parse --short origin/main 2>/dev/null || echo "N/A")
|
|
36
|
+
DEVELOP_LOCAL=$(git rev-parse --short develop 2>/dev/null || echo "N/A")
|
|
37
|
+
DEVELOP_REMOTE=$(git rev-parse --short origin/develop 2>/dev/null || echo "N/A")
|
|
38
|
+
|
|
39
|
+
# Divergence
|
|
40
|
+
DEVELOP_AHEAD=$(git rev-list --count origin/main..origin/develop 2>/dev/null || echo "0")
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 3. Active Branches
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Feature branches
|
|
47
|
+
FEATURES=$(git branch -r | grep "origin/feature/" | sed 's/origin\///')
|
|
48
|
+
|
|
49
|
+
# Release branches
|
|
50
|
+
RELEASES=$(git branch -r | grep "origin/release/" | sed 's/origin\///')
|
|
51
|
+
|
|
52
|
+
# Hotfix branches
|
|
53
|
+
HOTFIXES=$(git branch -r | grep "origin/hotfix/" | sed 's/origin\///')
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 4. Worktree Status
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
WORKTREES=$(git worktree list)
|
|
60
|
+
WORKTREE_COUNT=$(echo "$WORKTREES" | wc -l)
|
|
61
|
+
|
|
62
|
+
# Check for orphaned worktrees
|
|
63
|
+
ORPHANED=""
|
|
64
|
+
while read -r line; do
|
|
65
|
+
PATH=$(echo "$line" | awk '{print $1}')
|
|
66
|
+
BRANCH=$(echo "$line" | awk '{print $3}' | tr -d '[]')
|
|
67
|
+
[ ! -d "$PATH" ] && ORPHANED="$ORPHANED\n$PATH ($BRANCH)"
|
|
68
|
+
done <<< "$WORKTREES"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 5. Pending Changes
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Current branch changes
|
|
75
|
+
STAGED=$(git diff --cached --name-only | wc -l)
|
|
76
|
+
MODIFIED=$(git diff --name-only | wc -l)
|
|
77
|
+
UNTRACKED=$(git ls-files --others --exclude-standard | wc -l)
|
|
78
|
+
|
|
79
|
+
# Unpushed commits
|
|
80
|
+
UNPUSHED=$(git rev-list --count origin/$CURRENT..HEAD 2>/dev/null || echo "0")
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 6. EF Core Status
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Check for migrations
|
|
87
|
+
MIGRATIONS=$(find . -path "*/Migrations/*.cs" -not -name "*Designer*" -not -name "*Snapshot*" 2>/dev/null | wc -l)
|
|
88
|
+
|
|
89
|
+
# Check migration status
|
|
90
|
+
if command -v dotnet &> /dev/null; then
|
|
91
|
+
PENDING=$(dotnet ef migrations list 2>/dev/null | grep -c "(Pending)" || echo "0")
|
|
92
|
+
fi
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 7. Display Status
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
╔══════════════════════════════════════════════════════════════════╗
|
|
99
|
+
║ GITFLOW STATUS ║
|
|
100
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
101
|
+
║ Repository: {REPO_NAME} ║
|
|
102
|
+
║ Provider: {GIT_PROVIDER} ║
|
|
103
|
+
║ Current: {CURRENT} ║
|
|
104
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
105
|
+
|
|
106
|
+
## Main Branches
|
|
107
|
+
|
|
108
|
+
| Branch | Local | Remote | Status |
|
|
109
|
+
|--------|-------|--------|--------|
|
|
110
|
+
| main | {MAIN_LOCAL} | {MAIN_REMOTE} | {synced/diverged} |
|
|
111
|
+
| develop | {DEVELOP_LOCAL} | {DEVELOP_REMOTE} | {synced/diverged} |
|
|
112
|
+
|
|
113
|
+
develop → main: {DEVELOP_AHEAD} commits {DEVELOP_AHEAD > 10 ? "⚠️ Release recommended" : ""}
|
|
114
|
+
|
|
115
|
+
## Active Branches
|
|
116
|
+
|
|
117
|
+
**Features:** {count}
|
|
118
|
+
{list of feature branches with status}
|
|
119
|
+
|
|
120
|
+
**Releases:** {count}
|
|
121
|
+
{list of release branches}
|
|
122
|
+
|
|
123
|
+
**Hotfixes:** {count}
|
|
124
|
+
{list of hotfix branches}
|
|
125
|
+
|
|
126
|
+
## Worktrees
|
|
127
|
+
|
|
128
|
+
| Path | Branch | Status |
|
|
129
|
+
|------|--------|--------|
|
|
130
|
+
{worktree list with status}
|
|
131
|
+
|
|
132
|
+
{if orphaned}
|
|
133
|
+
⚠️ Orphaned worktrees detected:
|
|
134
|
+
{list}
|
|
135
|
+
→ Run: /gitflow cleanup
|
|
136
|
+
{endif}
|
|
137
|
+
|
|
138
|
+
## Working Directory
|
|
139
|
+
|
|
140
|
+
| Type | Count |
|
|
141
|
+
|------|-------|
|
|
142
|
+
| Staged | {STAGED} |
|
|
143
|
+
| Modified | {MODIFIED} |
|
|
144
|
+
| Untracked | {UNTRACKED} |
|
|
145
|
+
| Unpushed | {UNPUSHED} |
|
|
146
|
+
|
|
147
|
+
## EF Core
|
|
148
|
+
|
|
149
|
+
| Metric | Value |
|
|
150
|
+
|--------|-------|
|
|
151
|
+
| Migrations | {MIGRATIONS} |
|
|
152
|
+
| Pending | {PENDING} |
|
|
153
|
+
|
|
154
|
+
╚══════════════════════════════════════════════════════════════════╝
|
|
155
|
+
|
|
156
|
+
## Recommended Actions
|
|
157
|
+
|
|
158
|
+
{if UNPUSHED > 0}
|
|
159
|
+
- Push commits: /gitflow sync
|
|
160
|
+
{endif}
|
|
161
|
+
{if DEVELOP_AHEAD > 10}
|
|
162
|
+
- Create release: /gitflow start release
|
|
163
|
+
{endif}
|
|
164
|
+
{if ORPHANED}
|
|
165
|
+
- Clean worktrees: /gitflow cleanup
|
|
166
|
+
{endif}
|
|
167
|
+
{if STAGED + MODIFIED > 0}
|
|
168
|
+
- Commit changes: /gitflow commit
|
|
169
|
+
{endif}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## SUCCESS CRITERIA:
|
|
175
|
+
|
|
176
|
+
- Complete state displayed
|
|
177
|
+
- Recommendations provided
|
|
178
|
+
- No actions taken (diagnostic only)
|