@atlashub/smartstack-cli 1.13.2 → 1.14.1
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 +231 -236
- package/.documentation/hooks.html +1 -1
- package/.documentation/index.html +1 -1
- package/.documentation/init.html +3 -3
- package/.documentation/installation.html +1075 -351
- package/.documentation/ralph-loop.html +1 -1
- package/.documentation/test-web.html +1 -1
- package/README.md +88 -20
- package/config/default-config.json +10 -1
- 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 +70 -20
- 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 +31 -2
- package/templates/commands/efcore/db-reset.md +18 -6
- package/templates/commands/efcore/migration.md +1 -1
- package/templates/commands/efcore/rebase-snapshot.md +1 -1
- package/templates/commands/efcore/squash.md +1 -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 +334 -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
- package/templates/gitflow/config.json +0 -138
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: step-pr
|
|
3
|
+
description: Create pull request with auto-detection
|
|
4
|
+
next_step: null
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step: PR - Create Pull Request
|
|
8
|
+
|
|
9
|
+
## YOUR TASK:
|
|
10
|
+
|
|
11
|
+
Create a pull request with proper target, title, and description based on branch type.
|
|
12
|
+
|
|
13
|
+
**ULTRA THINK about PR requirements.**
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## EXECUTION SEQUENCE:
|
|
18
|
+
|
|
19
|
+
### 1. Detect Git Provider
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
REMOTE_URL=$(git remote get-url origin)
|
|
23
|
+
|
|
24
|
+
if [[ "$REMOTE_URL" == *"github.com"* ]]; then
|
|
25
|
+
GIT_PROVIDER="github"
|
|
26
|
+
elif [[ "$REMOTE_URL" == *"dev.azure.com"* ]] || [[ "$REMOTE_URL" == *"visualstudio.com"* ]]; then
|
|
27
|
+
GIT_PROVIDER="azuredevops"
|
|
28
|
+
# Extract Azure DevOps details
|
|
29
|
+
[[ "$REMOTE_URL" =~ dev\.azure\.com/([^/]+)/([^/]+)/_git/([^/]+) ]] && {
|
|
30
|
+
AZURE_ORG="${BASH_REMATCH[1]}"
|
|
31
|
+
AZURE_PROJECT="${BASH_REMATCH[2]}"
|
|
32
|
+
AZURE_REPO="${BASH_REMATCH[3]}"
|
|
33
|
+
}
|
|
34
|
+
else
|
|
35
|
+
GIT_PROVIDER="unknown"
|
|
36
|
+
fi
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Determine PR Target
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
CURRENT=$(git rev-parse --abbrev-ref HEAD)
|
|
43
|
+
|
|
44
|
+
case "$CURRENT" in
|
|
45
|
+
feature/*) TARGET_BRANCH="develop" ;;
|
|
46
|
+
release/*) TARGET_BRANCH="main" ;;
|
|
47
|
+
hotfix/*) TARGET_BRANCH="main" ;;
|
|
48
|
+
*) TARGET_BRANCH="develop" ;;
|
|
49
|
+
esac
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 3. Check Prerequisites
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Ensure branch is pushed
|
|
56
|
+
git fetch origin
|
|
57
|
+
REMOTE_EXISTS=$(git branch -r --list "origin/$CURRENT")
|
|
58
|
+
[ -z "$REMOTE_EXISTS" ] && {
|
|
59
|
+
echo "Branch not pushed to remote. Pushing..."
|
|
60
|
+
git push -u origin $CURRENT
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
# Check for uncommitted changes
|
|
64
|
+
DIRTY=$(git status --porcelain | wc -l)
|
|
65
|
+
[ "$DIRTY" -gt 0 ] && {
|
|
66
|
+
echo "⚠️ Uncommitted changes detected"
|
|
67
|
+
echo "→ Run /gitflow commit first"
|
|
68
|
+
STOP
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
# Check if PR already exists
|
|
72
|
+
EXISTING_PR=$(gh pr list --head "$CURRENT" --json number --jq '.[0].number' 2>/dev/null)
|
|
73
|
+
[ -n "$EXISTING_PR" ] && {
|
|
74
|
+
echo "PR #$EXISTING_PR already exists for this branch"
|
|
75
|
+
echo "→ View: gh pr view $EXISTING_PR"
|
|
76
|
+
STOP
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 4. Run Pre-PR Checks
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Build check
|
|
84
|
+
echo "Running build check..."
|
|
85
|
+
dotnet build --no-restore 2>&1 || {
|
|
86
|
+
echo "❌ Build failed. Fix before creating PR."
|
|
87
|
+
STOP
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
# Migration check
|
|
91
|
+
echo "Checking migrations..."
|
|
92
|
+
dotnet ef migrations list 2>&1 || echo "No migrations or EF Core not configured"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 5. Generate PR Content
|
|
96
|
+
|
|
97
|
+
**Title:**
|
|
98
|
+
```bash
|
|
99
|
+
BRANCH_NAME=$(echo $CURRENT | sed 's/.*\///')
|
|
100
|
+
BRANCH_TYPE=$(echo $CURRENT | cut -d'/' -f1)
|
|
101
|
+
|
|
102
|
+
case "$BRANCH_TYPE" in
|
|
103
|
+
feature) TITLE="feat: $BRANCH_NAME" ;;
|
|
104
|
+
hotfix) TITLE="fix: $BRANCH_NAME" ;;
|
|
105
|
+
release) TITLE="release: v$(grep -oP '"current":\s*"\K[^"]+' .claude/gitflow/config.json)" ;;
|
|
106
|
+
esac
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Body:**
|
|
110
|
+
```markdown
|
|
111
|
+
## Summary
|
|
112
|
+
|
|
113
|
+
{Auto-generated from commit messages}
|
|
114
|
+
|
|
115
|
+
## Changes
|
|
116
|
+
|
|
117
|
+
{List of files changed with categories}
|
|
118
|
+
|
|
119
|
+
## Testing
|
|
120
|
+
|
|
121
|
+
- [ ] Build passes
|
|
122
|
+
- [ ] Unit tests pass
|
|
123
|
+
- [ ] Manual testing completed
|
|
124
|
+
|
|
125
|
+
## EF Core Migrations
|
|
126
|
+
|
|
127
|
+
{Migration status: None | Added | Modified}
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
🤖 Generated with [Claude Code](https://claude.ai/code)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 6. Create Pull Request
|
|
135
|
+
|
|
136
|
+
**GitHub:**
|
|
137
|
+
```bash
|
|
138
|
+
gh pr create \
|
|
139
|
+
--title "$TITLE" \
|
|
140
|
+
--body "$(cat <<'EOF'
|
|
141
|
+
{PR_BODY}
|
|
142
|
+
EOF
|
|
143
|
+
)" \
|
|
144
|
+
--base "$TARGET_BRANCH" \
|
|
145
|
+
--head "$CURRENT"
|
|
146
|
+
|
|
147
|
+
PR_URL=$(gh pr view --json url --jq '.url')
|
|
148
|
+
PR_NUMBER=$(gh pr view --json number --jq '.number')
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Azure DevOps:**
|
|
152
|
+
```bash
|
|
153
|
+
az repos pr create \
|
|
154
|
+
--title "$TITLE" \
|
|
155
|
+
--description "{PR_BODY}" \
|
|
156
|
+
--source-branch "$CURRENT" \
|
|
157
|
+
--target-branch "$TARGET_BRANCH" \
|
|
158
|
+
--repository "$AZURE_REPO" \
|
|
159
|
+
--project "$AZURE_PROJECT" \
|
|
160
|
+
--org "https://dev.azure.com/$AZURE_ORG"
|
|
161
|
+
|
|
162
|
+
PR_ID=$(az repos pr list --source-branch "$CURRENT" --query "[0].pullRequestId" -o tsv)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 7. Add Labels (GitHub)
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
if [ "$GIT_PROVIDER" = "github" ]; then
|
|
169
|
+
case "$BRANCH_TYPE" in
|
|
170
|
+
feature) gh pr edit $PR_NUMBER --add-label "enhancement" ;;
|
|
171
|
+
hotfix) gh pr edit $PR_NUMBER --add-label "bug,priority" ;;
|
|
172
|
+
release) gh pr edit $PR_NUMBER --add-label "release" ;;
|
|
173
|
+
esac
|
|
174
|
+
fi
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### 8. Store PR Info
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Save for merge step
|
|
181
|
+
{
|
|
182
|
+
"pr_number": $PR_NUMBER,
|
|
183
|
+
"pr_url": "$PR_URL",
|
|
184
|
+
"target_branch": "$TARGET_BRANCH",
|
|
185
|
+
"git_provider": "$GIT_PROVIDER"
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### 9. Summary
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
╔══════════════════════════════════════════════════════════════════╗
|
|
193
|
+
║ PULL REQUEST CREATED ║
|
|
194
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
195
|
+
║ PR: #{PR_NUMBER} ║
|
|
196
|
+
║ Title: {TITLE} ║
|
|
197
|
+
║ URL: {PR_URL} ║
|
|
198
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
199
|
+
║ Source: {CURRENT} ║
|
|
200
|
+
║ Target: {TARGET_BRANCH} ║
|
|
201
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
202
|
+
║ Checks: ║
|
|
203
|
+
║ - Build: ✅ ║
|
|
204
|
+
║ - Migrations: {status} ║
|
|
205
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
206
|
+
║ NEXT STEPS: ║
|
|
207
|
+
║ 1. Wait for CI checks ║
|
|
208
|
+
║ 2. Request review ║
|
|
209
|
+
║ 3. After approval: /gitflow merge ║
|
|
210
|
+
╚══════════════════════════════════════════════════════════════════╝
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## ERROR HANDLING:
|
|
216
|
+
|
|
217
|
+
| Error | Solution |
|
|
218
|
+
|-------|----------|
|
|
219
|
+
| Branch not pushed | Auto-push before PR |
|
|
220
|
+
| PR already exists | Show existing PR |
|
|
221
|
+
| Build fails | Fix and re-run |
|
|
222
|
+
| No git provider | Manual PR creation |
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## SUCCESS CRITERIA:
|
|
227
|
+
|
|
228
|
+
- PR created with proper target
|
|
229
|
+
- Title and body generated
|
|
230
|
+
- Labels added (if GitHub)
|
|
231
|
+
- PR number stored for merge step
|
|
232
|
+
|
|
233
|
+
## NEXT STEP:
|
|
234
|
+
|
|
235
|
+
Wait for review, then `/gitflow merge`.
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: step-start
|
|
3
|
+
description: Create new branch with worktree
|
|
4
|
+
next_step: null
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step: START - Create Branch
|
|
8
|
+
|
|
9
|
+
## YOUR TASK:
|
|
10
|
+
|
|
11
|
+
Create a new feature/release/hotfix branch with optional worktree setup.
|
|
12
|
+
|
|
13
|
+
**ULTRA THINK about branch naming and base selection.**
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## INPUT PARSING:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
{branch_type} = feature | release | hotfix
|
|
21
|
+
{branch_name} = normalized name (kebab-case)
|
|
22
|
+
{no_worktree} = --no-worktree flag present
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**From flags:**
|
|
26
|
+
- `-f {name}` → branch_type=feature, branch_name={name}
|
|
27
|
+
- `-r {name}` → branch_type=release, branch_name={name}
|
|
28
|
+
- `-h {name}` → branch_type=hotfix, branch_name={name}
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## EXECUTION SEQUENCE:
|
|
33
|
+
|
|
34
|
+
### 1. Analyze Context
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
38
|
+
git fetch origin --quiet
|
|
39
|
+
|
|
40
|
+
# Version detection
|
|
41
|
+
VERSION=$(grep -oP '"current":\s*"\K[^"]+' .claude/gitflow/config.json 2>/dev/null || echo "0.1.0")
|
|
42
|
+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
|
|
43
|
+
|
|
44
|
+
# Develop ahead of main?
|
|
45
|
+
DEVELOP_AHEAD=$(git rev-list --count origin/main..origin/develop 2>/dev/null || echo "0")
|
|
46
|
+
|
|
47
|
+
# Working directory status
|
|
48
|
+
DIRTY=$(git status --porcelain | wc -l)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Display:**
|
|
52
|
+
```
|
|
53
|
+
Current: {CURRENT_BRANCH} | Version: {VERSION} | Tag: {LAST_TAG}
|
|
54
|
+
Develop → Main: {DEVELOP_AHEAD} commits {DEVELOP_AHEAD > 10 ? "(Release recommended)" : ""}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 2. Interactive Questions (if no args)
|
|
58
|
+
|
|
59
|
+
**If branch_type missing:**
|
|
60
|
+
```yaml
|
|
61
|
+
AskUserQuestion:
|
|
62
|
+
header: "Type"
|
|
63
|
+
question: "What type of branch?"
|
|
64
|
+
options:
|
|
65
|
+
- label: "Feature"
|
|
66
|
+
description: "New feature from develop"
|
|
67
|
+
- label: "Release v{X.Y+1.0}"
|
|
68
|
+
description: "Prepare release from develop"
|
|
69
|
+
- label: "Hotfix"
|
|
70
|
+
description: "Urgent fix from main"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**If branch_name missing:**
|
|
74
|
+
```yaml
|
|
75
|
+
AskUserQuestion:
|
|
76
|
+
header: "Name"
|
|
77
|
+
question: "Branch name? (will be normalized to kebab-case)"
|
|
78
|
+
# Free text input
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 3. Normalize and Validate
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Normalize name
|
|
85
|
+
normalize_branch_name() {
|
|
86
|
+
echo "$1" | tr '[:upper:]' '[:lower:]' | \
|
|
87
|
+
sed 'y/àâäéèêëïîôùûüçœæ/aaaeeeeiioouucoa/' | \
|
|
88
|
+
sed "s/[ _']/-/g" | sed 's/[^a-z0-9-]//g' | \
|
|
89
|
+
sed 's/--*/-/g' | sed 's/^-//;s/-$//' | cut -c1-50
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
BRANCH_NAME=$(normalize_branch_name "$branch_name")
|
|
93
|
+
FULL_BRANCH="${branch_type}/${BRANCH_NAME}"
|
|
94
|
+
|
|
95
|
+
# Check if exists
|
|
96
|
+
LOCAL_EXISTS=$(git branch --list "$FULL_BRANCH")
|
|
97
|
+
REMOTE_EXISTS=$(git branch -r --list "origin/$FULL_BRANCH")
|
|
98
|
+
|
|
99
|
+
[ -n "$LOCAL_EXISTS" ] || [ -n "$REMOTE_EXISTS" ] && {
|
|
100
|
+
echo "ERROR: Branch '$FULL_BRANCH' already exists"
|
|
101
|
+
# Options: Different name | Checkout existing | Delete and recreate
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 4. Determine Base Branch
|
|
106
|
+
|
|
107
|
+
| Type | Base Branch | Target |
|
|
108
|
+
|------|-------------|--------|
|
|
109
|
+
| feature | develop | develop |
|
|
110
|
+
| release | develop | main + develop |
|
|
111
|
+
| hotfix | main | main + develop |
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
case "$branch_type" in
|
|
115
|
+
feature) BASE_BRANCH="develop"; TARGET="develop" ;;
|
|
116
|
+
release) BASE_BRANCH="develop"; TARGET="main" ;;
|
|
117
|
+
hotfix) BASE_BRANCH="main"; TARGET="main" ;;
|
|
118
|
+
esac
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 5. Handle Dirty Working Directory
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
[ "$DIRTY" -gt 0 ] && {
|
|
125
|
+
echo "Working directory has uncommitted changes"
|
|
126
|
+
# Options: Stash | Commit | Continue anyway | Cancel
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 6. Create Branch and Worktree
|
|
131
|
+
|
|
132
|
+
**Read worktree mode from config:**
|
|
133
|
+
```bash
|
|
134
|
+
WORKTREE_MODE=$(grep -oP '"mode":\s*"\K[^"]+' .claude/gitflow/config.json 2>/dev/null || echo "organized")
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Mode: organized**
|
|
138
|
+
```bash
|
|
139
|
+
case "$branch_type" in
|
|
140
|
+
feature) WORKTREE_PATH="../features/$BRANCH_NAME" ;;
|
|
141
|
+
release) WORKTREE_PATH="../releases/v$VERSION" ;;
|
|
142
|
+
hotfix) WORKTREE_PATH="../hotfixes/$BRANCH_NAME" ;;
|
|
143
|
+
esac
|
|
144
|
+
|
|
145
|
+
mkdir -p "$(dirname $WORKTREE_PATH)"
|
|
146
|
+
git worktree add -b "$FULL_BRANCH" "$WORKTREE_PATH" "origin/$BASE_BRANCH"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Mode: --no-worktree**
|
|
150
|
+
```bash
|
|
151
|
+
git checkout "$BASE_BRANCH" && git pull origin "$BASE_BRANCH"
|
|
152
|
+
git checkout -b "$FULL_BRANCH"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 7. Create Local Environment Config (Backend + Frontend)
|
|
156
|
+
|
|
157
|
+
**Detect project structure:**
|
|
158
|
+
```bash
|
|
159
|
+
# Find API project directory
|
|
160
|
+
API_DIR=$(find "$WORKTREE_PATH" -type d -name "*.Api" -path "*/src/*" | head -1)
|
|
161
|
+
# Find Web project directory
|
|
162
|
+
WEB_DIR=$(find "$WORKTREE_PATH" -type d -name "*-web" -path "*/web/*" | head -1)
|
|
163
|
+
|
|
164
|
+
# Generate unique ports based on branch name hash (to avoid conflicts between worktrees)
|
|
165
|
+
HASH=$(echo "$BRANCH_NAME" | md5sum | cut -c1-4)
|
|
166
|
+
HASH_NUM=$((16#$HASH % 100))
|
|
167
|
+
API_PORT=$((5200 + HASH_NUM))
|
|
168
|
+
WEB_PORT=$((5300 + HASH_NUM))
|
|
169
|
+
|
|
170
|
+
# Project and DB naming
|
|
171
|
+
PROJECT_NAME=$(basename $(pwd) | tr '[:upper:]' '[:lower:]')
|
|
172
|
+
DB_NAME=$(echo "${PROJECT_NAME}_${branch_type}_${BRANCH_NAME}" | cut -c1-63)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
#### 7a. Backend: appsettings.Local.json
|
|
176
|
+
|
|
177
|
+
**If API project detected:**
|
|
178
|
+
```bash
|
|
179
|
+
[ -n "$API_DIR" ] && [ -f "$API_DIR/appsettings.json" ] && {
|
|
180
|
+
cat > "$API_DIR/appsettings.Local.json" << EOF
|
|
181
|
+
{
|
|
182
|
+
"ConnectionStrings": {
|
|
183
|
+
"DefaultConnection": "Server=localhost;Database=${DB_NAME};Trusted_Connection=true;TrustServerCertificate=true"
|
|
184
|
+
},
|
|
185
|
+
"Authentication": {
|
|
186
|
+
"FrontendUrl": "http://localhost:${WEB_PORT}"
|
|
187
|
+
},
|
|
188
|
+
"Kestrel": {
|
|
189
|
+
"Endpoints": {
|
|
190
|
+
"Http": {
|
|
191
|
+
"Url": "http://localhost:${API_PORT}"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"Serilog": {
|
|
196
|
+
"MinimumLevel": {
|
|
197
|
+
"Default": "Debug"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
EOF
|
|
202
|
+
echo "Created: $API_DIR/appsettings.Local.json (DB: $DB_NAME, Port: $API_PORT)"
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
#### 7b. Frontend: .env.local + npm script
|
|
207
|
+
|
|
208
|
+
**If Web project detected:**
|
|
209
|
+
```bash
|
|
210
|
+
[ -n "$WEB_DIR" ] && [ -f "$WEB_DIR/package.json" ] && {
|
|
211
|
+
# Create .env.local
|
|
212
|
+
cat > "$WEB_DIR/.env.local" << EOF
|
|
213
|
+
# Local environment configuration
|
|
214
|
+
# Generated by /gitflow:start for branch: ${FULL_BRANCH}
|
|
215
|
+
# Run with: npm run local
|
|
216
|
+
|
|
217
|
+
VITE_API_URL=http://localhost:${API_PORT}
|
|
218
|
+
VITE_APP_ENV=local
|
|
219
|
+
VITE_DEBUG=true
|
|
220
|
+
EOF
|
|
221
|
+
echo "Created: $WEB_DIR/.env.local (API: localhost:$API_PORT)"
|
|
222
|
+
|
|
223
|
+
# Add "local" script to package.json if not exists
|
|
224
|
+
if ! grep -q '"local"' "$WEB_DIR/package.json"; then
|
|
225
|
+
# Use Node.js to safely modify package.json
|
|
226
|
+
node -e "
|
|
227
|
+
const fs = require('fs');
|
|
228
|
+
const pkg = JSON.parse(fs.readFileSync('$WEB_DIR/package.json', 'utf8'));
|
|
229
|
+
if (!pkg.scripts.local) {
|
|
230
|
+
pkg.scripts.local = 'vite --mode local --port ${WEB_PORT}';
|
|
231
|
+
fs.writeFileSync('$WEB_DIR/package.json', JSON.stringify(pkg, null, 2) + '\n');
|
|
232
|
+
console.log('Added script: npm run local');
|
|
233
|
+
}
|
|
234
|
+
"
|
|
235
|
+
fi
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### 7c. Summary of local config
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
243
|
+
│ LOCAL ENVIRONMENT CONFIGURED │
|
|
244
|
+
├─────────────────────────────────────────────────────────────┤
|
|
245
|
+
│ Database: ${DB_NAME} │
|
|
246
|
+
│ API Port: ${API_PORT} → dotnet run --environment Local │
|
|
247
|
+
│ Web Port: ${WEB_PORT} → npm run local │
|
|
248
|
+
└─────────────────────────────────────────────────────────────┘
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### 8. Store State
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
# Save to state for next steps
|
|
255
|
+
{
|
|
256
|
+
"branch_type": "{branch_type}",
|
|
257
|
+
"branch_name": "{FULL_BRANCH}",
|
|
258
|
+
"base_branch": "{BASE_BRANCH}",
|
|
259
|
+
"target_branch": "{TARGET}",
|
|
260
|
+
"worktree_path": "{WORKTREE_PATH}",
|
|
261
|
+
"version_current": "{VERSION}",
|
|
262
|
+
"local_config": {
|
|
263
|
+
"database": "{DB_NAME}",
|
|
264
|
+
"api_port": "{API_PORT}",
|
|
265
|
+
"web_port": "{WEB_PORT}",
|
|
266
|
+
"api_dir": "{API_DIR}",
|
|
267
|
+
"web_dir": "{WEB_DIR}"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### 9. Summary
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
╔══════════════════════════════════════════════════════════════════╗
|
|
276
|
+
║ {BRANCH_TYPE} CREATED ║
|
|
277
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
278
|
+
║ Branch: {FULL_BRANCH} ║
|
|
279
|
+
║ Base: {BASE_BRANCH} ║
|
|
280
|
+
║ Target: {TARGET} ║
|
|
281
|
+
║ Worktree: {WORKTREE_PATH} ║
|
|
282
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
283
|
+
║ LOCAL ENVIRONMENT: ║
|
|
284
|
+
║ Database: {DB_NAME} ║
|
|
285
|
+
║ API: http://localhost:{API_PORT} ║
|
|
286
|
+
║ Web: http://localhost:{WEB_PORT} ║
|
|
287
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
288
|
+
║ NEXT STEPS: ║
|
|
289
|
+
║ ║
|
|
290
|
+
║ 1. Go to worktree: ║
|
|
291
|
+
║ cd {WORKTREE_PATH} ║
|
|
292
|
+
║ ║
|
|
293
|
+
║ 2. Start local environment: ║
|
|
294
|
+
║ # Terminal 1 - Backend: ║
|
|
295
|
+
║ cd src/SmartStack.Api && dotnet run --environment Local ║
|
|
296
|
+
║ # Terminal 2 - Frontend: ║
|
|
297
|
+
║ cd web/smartstack-web && npm run local ║
|
|
298
|
+
║ ║
|
|
299
|
+
║ 3. Make changes and commit: ║
|
|
300
|
+
║ /gitflow commit ║
|
|
301
|
+
║ ║
|
|
302
|
+
║ 4. Create pull request: ║
|
|
303
|
+
║ /gitflow pr ║
|
|
304
|
+
║ ║
|
|
305
|
+
║ 5. After PR merged, finalize: ║
|
|
306
|
+
║ /gitflow finish ║
|
|
307
|
+
╚══════════════════════════════════════════════════════════════════╝
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## ERROR HANDLING:
|
|
313
|
+
|
|
314
|
+
| Error | Solution |
|
|
315
|
+
|-------|----------|
|
|
316
|
+
| Branch exists | Offer: rename, checkout, or delete |
|
|
317
|
+
| Dirty working directory | Offer: stash, commit, or continue |
|
|
318
|
+
| Worktree path exists | Remove orphan or use different path |
|
|
319
|
+
| Base branch behind remote | Pull before creating |
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## SUCCESS CRITERIA:
|
|
324
|
+
|
|
325
|
+
- Branch created from correct base
|
|
326
|
+
- Worktree set up (if enabled)
|
|
327
|
+
- Backend local config created: `appsettings.Local.json` (if .NET API detected)
|
|
328
|
+
- Frontend local config created: `.env.local` + `npm run local` script (if web project detected)
|
|
329
|
+
- Ports synchronized between backend and frontend (unique per branch)
|
|
330
|
+
- State stored for subsequent steps
|
|
331
|
+
|
|
332
|
+
## NEXT STEP:
|
|
333
|
+
|
|
334
|
+
User works on code, then runs `/gitflow commit`.
|