@atlashub/smartstack-cli 3.37.0 → 3.39.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/dist/index.js +16 -24
- package/dist/index.js.map +1 -1
- package/dist/mcp-entry.mjs +235 -265
- package/dist/mcp-entry.mjs.map +1 -1
- package/package.json +1 -1
- package/scripts/extract-api-endpoints.ts +5 -5
- package/scripts/generate-doc-with-mock-ui.ts +10 -17
- package/templates/agents/ba-reader.md +9 -9
- package/templates/agents/ba-writer.md +12 -15
- package/templates/agents/code-reviewer.md +1 -1
- package/templates/agents/docs-context-reader.md +1 -1
- package/templates/agents/efcore/scan.md +3 -1
- package/templates/agents/gitflow/commit.md +74 -0
- package/templates/agents/gitflow/finish.md +5 -2
- package/templates/agents/gitflow/init-clone.md +3 -3
- package/templates/agents/gitflow/init-validate.md +3 -2
- package/templates/agents/gitflow/merge.md +5 -4
- package/templates/agents/gitflow/pr.md +5 -4
- package/templates/agents/gitflow/start.md +37 -5
- package/templates/hooks/hooks.json +11 -0
- package/templates/hooks/wsl-dotnet-cleanup.sh +24 -0
- package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +20 -20
- package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +16 -24
- package/templates/mcp-scaffolding/migrations/seed-roles.cs.hbs +2 -2
- package/templates/skills/_resources/mcp-validate-documentation-spec.md +3 -3
- package/templates/skills/_shared.md +15 -17
- package/templates/skills/ai-prompt/SKILL.md +1 -1
- package/templates/skills/ai-prompt/steps/step-00-init.md +47 -0
- package/templates/skills/apex/SKILL.md +3 -4
- package/templates/skills/apex/_shared.md +10 -20
- package/templates/skills/apex/references/analysis-methods.md +141 -0
- package/templates/skills/apex/references/challenge-questions.md +1 -21
- package/templates/skills/apex/references/core-seed-data.md +35 -58
- package/templates/skills/apex/references/examine-build-validation.md +82 -0
- package/templates/skills/apex/references/execution-frontend-gates.md +177 -0
- package/templates/skills/apex/references/execution-frontend-patterns.md +105 -0
- package/templates/skills/apex/references/execution-layer1-rules.md +96 -0
- package/templates/skills/apex/references/initialization-challenge-flow.md +110 -0
- package/templates/skills/apex/references/planning-layer-mapping.md +151 -0
- package/templates/skills/apex/references/post-checks.md +145 -40
- package/templates/skills/apex/references/smartstack-api.md +35 -51
- package/templates/skills/apex/references/smartstack-frontend.md +18 -18
- package/templates/skills/apex/references/smartstack-layers.md +38 -62
- package/templates/skills/apex/steps/step-00-init.md +14 -26
- package/templates/skills/apex/steps/step-01-analyze.md +10 -143
- package/templates/skills/apex/steps/step-02-plan.md +10 -92
- package/templates/skills/apex/steps/step-03-execute.md +45 -252
- package/templates/skills/apex/steps/step-04-examine.md +14 -78
- package/templates/skills/apex/steps/step-05-deep-review.md +2 -2
- package/templates/skills/apex/steps/step-08-run-tests.md +1 -0
- package/templates/skills/application/SKILL.md +241 -242
- package/templates/skills/application/references/backend-controller-hierarchy.md +16 -16
- package/templates/skills/application/references/backend-seeding-and-dto-output.md +83 -0
- package/templates/skills/application/references/backend-table-prefix-mapping.md +79 -0
- package/templates/skills/application/references/backend-verification.md +1 -1
- package/templates/skills/application/references/frontend-i18n-and-output.md +67 -0
- package/templates/skills/application/references/frontend-route-naming.md +117 -0
- package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +107 -0
- package/templates/skills/application/references/frontend-verification.md +12 -12
- package/templates/skills/application/references/init-parameter-detection.md +121 -0
- package/templates/skills/application/references/migration-checklist-troubleshooting.md +100 -0
- package/templates/skills/application/references/nav-fallback-procedure.md +199 -200
- package/templates/skills/application/references/provider-template.md +2 -6
- package/templates/skills/application/references/roles-client-project-handling.md +55 -0
- package/templates/skills/application/references/roles-fallback-procedure.md +149 -0
- package/templates/skills/application/references/test-coverage-requirements.md +213 -0
- package/templates/skills/application/references/test-frontend.md +3 -3
- package/templates/skills/application/steps/step-00-init.md +130 -260
- package/templates/skills/application/steps/step-01-navigation.md +170 -170
- package/templates/skills/application/steps/step-02-permissions.md +196 -196
- package/templates/skills/application/steps/step-03-roles.md +182 -339
- package/templates/skills/application/steps/step-03b-provider.md +133 -134
- package/templates/skills/application/steps/step-04-backend.md +174 -265
- package/templates/skills/application/steps/step-05-frontend.md +18 -144
- package/templates/skills/application/steps/step-06-migration.md +12 -60
- package/templates/skills/application/steps/step-07-tests.md +9 -76
- package/templates/skills/application/templates-backend.md +29 -27
- package/templates/skills/application/templates-frontend.md +49 -49
- package/templates/skills/application/templates-seed.md +57 -131
- package/templates/skills/business-analyse/SKILL.md +27 -30
- package/templates/skills/business-analyse/_architecture.md +6 -6
- package/templates/skills/business-analyse/_shared.md +60 -88
- package/templates/skills/business-analyse/questionnaire/04-data.md +3 -3
- package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
- package/templates/skills/business-analyse/questionnaire/13-cross-module.md +1 -1
- package/templates/skills/business-analyse/react/application-viewer.md +12 -12
- package/templates/skills/business-analyse/react/components.md +8 -12
- package/templates/skills/business-analyse/react/schema.md +836 -836
- package/templates/skills/business-analyse/references/agent-module-prompt.md +2 -3
- package/templates/skills/business-analyse/references/analysis-semantic-checks.md +190 -0
- package/templates/skills/business-analyse/references/cache-warming-strategy.md +2 -2
- package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +41 -0
- package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +74 -0
- package/templates/skills/business-analyse/references/cadrage-shared-modules.md +69 -0
- package/templates/skills/business-analyse/references/cadrage-structure-cards.md +1 -1
- package/templates/skills/business-analyse/references/compilation-structure-cards.md +297 -0
- package/templates/skills/business-analyse/references/consolidation-structural-checks.md +2 -2
- package/templates/skills/business-analyse/references/deploy-modes.md +5 -5
- package/templates/skills/business-analyse/references/detection-strategies.md +7 -7
- package/templates/skills/business-analyse/references/handoff-file-templates.md +14 -22
- package/templates/skills/business-analyse/references/handoff-mappings.md +4 -4
- package/templates/skills/business-analyse/references/handoff-seeddata-generation.md +312 -0
- package/templates/skills/business-analyse/references/init-schema-deployment.md +3 -3
- package/templates/skills/business-analyse/references/naming-conventions.md +22 -24
- package/templates/skills/business-analyse/references/prd-generation.md +2 -2
- package/templates/skills/business-analyse/references/review-data-mapping.md +2 -2
- package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
- package/templates/skills/business-analyse/references/spec-auto-inference.md +3 -3
- package/templates/skills/business-analyse/references/team-orchestration.md +49 -6
- package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
- package/templates/skills/business-analyse/references/ui-resource-cards.md +18 -18
- package/templates/skills/business-analyse/references/validate-incremental-html.md +2 -2
- package/templates/skills/business-analyse/references/validation-checklist.md +2 -2
- package/templates/skills/business-analyse/schemas/application-schema.json +4 -5
- package/templates/skills/business-analyse/schemas/project-schema.json +1 -6
- package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +2 -3
- package/templates/skills/business-analyse/schemas/sections/specification-schema.json +4 -4
- package/templates/skills/business-analyse/steps/step-00-init.md +8 -17
- package/templates/skills/business-analyse/steps/step-01-cadrage.md +35 -198
- package/templates/skills/business-analyse/steps/step-01b-applications.md +16 -20
- package/templates/skills/business-analyse/steps/step-02-decomposition.md +1 -1
- package/templates/skills/business-analyse/steps/step-03a1-setup.md +4 -4
- package/templates/skills/business-analyse/steps/step-03a2-analysis.md +1 -1
- package/templates/skills/business-analyse/steps/step-03b-ui.md +4 -4
- package/templates/skills/business-analyse/steps/step-03c-compile.md +66 -140
- package/templates/skills/business-analyse/steps/step-03d-validate.md +2 -2
- package/templates/skills/business-analyse/steps/step-04a-collect.md +2 -2
- package/templates/skills/business-analyse/steps/step-04b-analyze.md +42 -160
- package/templates/skills/business-analyse/steps/step-04c-decide.md +1 -1
- package/templates/skills/business-analyse/steps/step-05a-handoff.md +74 -104
- package/templates/skills/business-analyse/steps/step-05b-deploy.md +13 -11
- package/templates/skills/business-analyse/steps/step-06-review.md +3 -3
- package/templates/skills/business-analyse/templates/tpl-frd.md +13 -13
- package/templates/skills/business-analyse/templates/tpl-handoff.md +12 -12
- package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
- package/templates/skills/business-analyse/templates-frd.md +25 -25
- package/templates/skills/business-analyse/templates-react.md +15 -21
- package/templates/skills/controller/SKILL.md +1 -1
- package/templates/skills/controller/postman-templates.md +1 -1
- package/templates/skills/controller/references/controller-code-templates.md +2 -2
- package/templates/skills/controller/references/mcp-scaffold-workflow.md +209 -0
- package/templates/skills/controller/references/permission-sync-templates.md +13 -16
- package/templates/skills/controller/steps/step-00-init.md +11 -11
- package/templates/skills/controller/steps/step-03-generate.md +64 -103
- package/templates/skills/controller/templates.md +67 -71
- package/templates/skills/debug/SKILL.md +13 -218
- package/templates/skills/debug/steps/step-00-init.md +57 -0
- package/templates/skills/debug/steps/step-01-analyze.md +219 -0
- package/templates/skills/debug/steps/step-02-resolve.md +85 -0
- package/templates/skills/documentation/SKILL.md +49 -345
- package/templates/skills/documentation/data-schema.md +11 -8
- package/templates/skills/documentation/steps/step-00-init.md +70 -0
- package/templates/skills/documentation/steps/step-01-scan.md +113 -0
- package/templates/skills/documentation/steps/step-02-generate.md +231 -0
- package/templates/skills/documentation/steps/step-03-validate.md +238 -0
- package/templates/skills/documentation/templates.md +480 -322
- package/templates/skills/efcore/SKILL.md +1 -1
- package/templates/skills/efcore/references/both-contexts.md +32 -0
- package/templates/skills/efcore/references/database-operations.md +67 -0
- package/templates/skills/efcore/references/destructive-operations.md +38 -0
- package/templates/skills/efcore/references/reset-operations.md +81 -0
- package/templates/skills/efcore/references/seed-methods.md +86 -0
- package/templates/skills/efcore/references/shared-init-functions.md +250 -0
- package/templates/skills/efcore/references/sql-objects-injection.md +61 -0
- package/templates/skills/efcore/references/troubleshooting.md +81 -0
- package/templates/skills/efcore/steps/db/step-deploy.md +1 -32
- package/templates/skills/efcore/steps/db/step-reset.md +7 -103
- package/templates/skills/efcore/steps/db/step-seed.md +10 -132
- package/templates/skills/efcore/steps/db/step-status.md +5 -44
- package/templates/skills/efcore/steps/migration/step-02-create.md +1 -14
- package/templates/skills/efcore/steps/migration/step-03-validate.md +8 -62
- package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +1 -57
- package/templates/skills/efcore/steps/shared/step-00-init.md +11 -254
- package/templates/skills/efcore/steps/squash/step-03-create.md +1 -58
- package/templates/skills/feature-full/SKILL.md +1 -1
- package/templates/skills/feature-full/steps/step-00-init.md +57 -0
- package/templates/skills/feature-full/steps/step-01-implementation.md +1 -1
- package/templates/skills/gitflow/SKILL.md +28 -5
- package/templates/skills/gitflow/_shared.md +109 -12
- package/templates/skills/gitflow/phases/abort.md +4 -0
- package/templates/skills/gitflow/phases/cleanup.md +4 -0
- package/templates/skills/gitflow/references/commit-message-generation.md +58 -0
- package/templates/skills/gitflow/references/commit-migration-validation.md +49 -0
- package/templates/skills/gitflow/references/finish-cleanup.md +55 -0
- package/templates/skills/gitflow/references/finish-version-bumping.md +45 -0
- package/templates/skills/gitflow/references/init-environment-detection.md +41 -0
- package/templates/skills/gitflow/references/init-questions.md +185 -0
- package/templates/skills/gitflow/references/init-structure-creation.md +75 -0
- package/templates/skills/gitflow/references/init-version-detection.md +21 -0
- package/templates/skills/gitflow/references/init-workspace-detection.md +43 -0
- package/templates/skills/gitflow/references/merge-ci-status.md +36 -0
- package/templates/skills/gitflow/references/merge-execution.md +62 -0
- package/templates/skills/gitflow/references/merge-pr-context.md +76 -0
- package/templates/skills/gitflow/references/pr-build-checks.md +60 -0
- package/templates/skills/gitflow/references/pr-generation.md +58 -0
- package/templates/skills/gitflow/references/start-branch-normalization.md +28 -0
- package/templates/skills/gitflow/references/start-worktree-creation.md +50 -0
- package/templates/skills/gitflow/references/sync-push-verify.md +44 -0
- package/templates/skills/gitflow/references/sync-rebase-conflicts.md +38 -0
- package/templates/skills/gitflow/steps/step-commit.md +12 -91
- package/templates/skills/gitflow/steps/step-finish.md +15 -159
- package/templates/skills/gitflow/steps/step-init.md +24 -326
- package/templates/skills/gitflow/steps/step-merge.md +17 -176
- package/templates/skills/gitflow/steps/step-pr.md +10 -116
- package/templates/skills/gitflow/steps/step-start.md +16 -109
- package/templates/skills/gitflow/steps/step-sync.md +6 -69
- package/templates/skills/ralph-loop/SKILL.md +6 -0
- package/templates/skills/ralph-loop/references/category-completeness.md +185 -0
- package/templates/skills/ralph-loop/references/compact-loop.md +1 -1
- package/templates/skills/ralph-loop/references/init-resume-recovery.md +127 -0
- package/templates/skills/ralph-loop/references/module-transition.md +151 -0
- package/templates/skills/ralph-loop/references/multi-module-queue.md +171 -0
- package/templates/skills/ralph-loop/references/parallel-execution.md +246 -0
- package/templates/skills/ralph-loop/references/task-transform-legacy.md +6 -9
- package/templates/skills/ralph-loop/references/team-orchestration.md +45 -3
- package/templates/skills/ralph-loop/steps/step-00-init.md +36 -109
- package/templates/skills/ralph-loop/steps/step-01-task.md +15 -163
- package/templates/skills/ralph-loop/steps/step-02-execute.md +8 -154
- package/templates/skills/ralph-loop/steps/step-04-check.md +20 -73
- package/templates/skills/review-code/references/owasp-api-top10.md +5 -5
- package/templates/skills/review-code/references/smartstack-conventions.md +568 -568
- package/templates/skills/validate-feature/references/api-smoke-tests.md +140 -0
- package/templates/skills/validate-feature/references/db-validation-checks.md +180 -0
- package/templates/skills/validate-feature/steps/step-01-compile.md +1 -3
- package/templates/skills/validate-feature/steps/step-04-api-smoke.md +34 -145
- package/templates/skills/validate-feature/steps/step-05-db-validation.md +74 -260
- package/templates/skills/workflow/SKILL.md +1 -1
- package/templates/skills/workflow/steps/step-00-init.md +57 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Commit Message Generation
|
|
2
|
+
|
|
3
|
+
## Determine Commit Type
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# Determine commit type from branch
|
|
7
|
+
BRANCH_TYPE=$(echo $CURRENT | cut -d'/' -f1)
|
|
8
|
+
case "$BRANCH_TYPE" in
|
|
9
|
+
feature) PREFIX="feat" ;;
|
|
10
|
+
hotfix) PREFIX="fix" ;;
|
|
11
|
+
release) PREFIX="chore" ;;
|
|
12
|
+
*) PREFIX="chore" ;;
|
|
13
|
+
esac
|
|
14
|
+
|
|
15
|
+
# Determine scope from branch name
|
|
16
|
+
SCOPE=$(echo $CURRENT | cut -d'/' -f2 | cut -d'-' -f1)
|
|
17
|
+
|
|
18
|
+
# If migrations present
|
|
19
|
+
[ "$HAS_MIGRATIONS" = "true" ] && PREFIX="db(migrations)"
|
|
20
|
+
|
|
21
|
+
# Generate message from diff analysis
|
|
22
|
+
SUMMARY=$(git diff --cached --stat | tail -1 | sed 's/^ *//')
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Message Format
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
{type}({scope}): {summary - 50 chars max}
|
|
29
|
+
|
|
30
|
+
**CHANGE**
|
|
31
|
+
PROBLEM: {what was wrong}
|
|
32
|
+
SOLUTION: {what was done}
|
|
33
|
+
IMPACT: {benefit}
|
|
34
|
+
|
|
35
|
+
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Stage and Create Commit
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Stage all changes
|
|
42
|
+
git add -A
|
|
43
|
+
|
|
44
|
+
# Show what will be committed
|
|
45
|
+
echo "Files to commit:"
|
|
46
|
+
git diff --cached --stat
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Create Commit
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
git commit -m "$(cat <<'EOF'
|
|
53
|
+
{generated_message}
|
|
54
|
+
EOF
|
|
55
|
+
)"
|
|
56
|
+
|
|
57
|
+
COMMIT_HASH=$(git rev-parse --short HEAD)
|
|
58
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Migration File Validation
|
|
2
|
+
|
|
3
|
+
## Detect EF Core Migrations
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# Find migration files in changes
|
|
7
|
+
MIGRATIONS=$(echo "$STAGED $MODIFIED $UNTRACKED" | tr ' ' '\n' | grep -E "Migrations/.*\.cs$")
|
|
8
|
+
HAS_MIGRATIONS=$([ -n "$MIGRATIONS" ] && echo "true" || echo "false")
|
|
9
|
+
|
|
10
|
+
if [ "$HAS_MIGRATIONS" = "true" ]; then
|
|
11
|
+
# Check for the 3 required files
|
|
12
|
+
MIGRATION_NAME=$(echo "$MIGRATIONS" | grep -v "Designer\|Snapshot" | head -1 | sed 's/.*\///' | sed 's/\.cs$//')
|
|
13
|
+
|
|
14
|
+
HAS_MAIN=$(echo "$MIGRATIONS" | grep -c "${MIGRATION_NAME}.cs")
|
|
15
|
+
HAS_DESIGNER=$(echo "$MIGRATIONS" | grep -c "${MIGRATION_NAME}.Designer.cs")
|
|
16
|
+
HAS_SNAPSHOT=$(echo "$MIGRATIONS" | grep -c "ModelSnapshot.cs")
|
|
17
|
+
|
|
18
|
+
[ "$HAS_MAIN" -eq 0 ] || [ "$HAS_DESIGNER" -eq 0 ] || [ "$HAS_SNAPSHOT" -eq 0 ] && {
|
|
19
|
+
echo "❌ INCOMPLETE MIGRATION"
|
|
20
|
+
echo "Required: Migration.cs + Designer.cs + ModelSnapshot.cs"
|
|
21
|
+
echo "Found: Main=$HAS_MAIN, Designer=$HAS_DESIGNER, Snapshot=$HAS_SNAPSHOT"
|
|
22
|
+
STOP
|
|
23
|
+
}
|
|
24
|
+
fi
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Check Destructive Operations (BLOCKING)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
if [ "$HAS_MIGRATIONS" = "true" ]; then
|
|
31
|
+
DESTRUCTIVE=$(grep -l "DropTable\|DropColumn\|DeleteData" $MIGRATIONS 2>/dev/null)
|
|
32
|
+
|
|
33
|
+
[ -n "$DESTRUCTIVE" ] && {
|
|
34
|
+
echo "⚠️ DESTRUCTIVE OPERATIONS DETECTED"
|
|
35
|
+
grep -n "DropTable\|DropColumn\|DeleteData" $DESTRUCTIVE
|
|
36
|
+
|
|
37
|
+
# Require explicit confirmation
|
|
38
|
+
AskUserQuestion:
|
|
39
|
+
header: "Confirm"
|
|
40
|
+
question: "Destructive migration detected. Continue?"
|
|
41
|
+
options:
|
|
42
|
+
- label: "Yes, I understand the risks"
|
|
43
|
+
- label: "No, let me review"
|
|
44
|
+
|
|
45
|
+
# Log to audit trail
|
|
46
|
+
echo "$(date) - DESTRUCTIVE: $DESTRUCTIVE - User: $USER" >> .claude/gitflow/logs/audit.log
|
|
47
|
+
}
|
|
48
|
+
fi
|
|
49
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Worktree and Branch Cleanup
|
|
2
|
+
|
|
3
|
+
## Clean Up Worktree
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# Repair cross-platform worktree paths before cleanup (WSL ↔ Windows)
|
|
7
|
+
detect_platform
|
|
8
|
+
repair_worktree_paths "$(git rev-parse --git-common-dir 2>/dev/null || echo '.bare')"
|
|
9
|
+
|
|
10
|
+
# Find worktree for this branch (use --porcelain for reliable parsing)
|
|
11
|
+
WORKTREE_PATH=$(git worktree list --porcelain | grep -B2 "branch refs/heads/$BRANCH" | grep "^worktree " | sed 's/^worktree //')
|
|
12
|
+
|
|
13
|
+
if [ -n "$WORKTREE_PATH" ] && [ -d "$WORKTREE_PATH" ]; then
|
|
14
|
+
echo "Removing worktree: $WORKTREE_PATH"
|
|
15
|
+
|
|
16
|
+
# Make sure we're not in the worktree directory
|
|
17
|
+
cd "$GF_DEVELOP_PATH" 2>/dev/null || cd "$(git rev-parse --show-toplevel)"
|
|
18
|
+
|
|
19
|
+
git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || {
|
|
20
|
+
rm -rf "$WORKTREE_PATH"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
git worktree prune
|
|
24
|
+
echo "✅ Worktree removed"
|
|
25
|
+
fi
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Delete Remote and Local Branches
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Check if remote branch still exists
|
|
32
|
+
REMOTE_EXISTS=$(git branch -r --list "origin/$BRANCH")
|
|
33
|
+
|
|
34
|
+
if [ -n "$REMOTE_EXISTS" ]; then
|
|
35
|
+
echo "Deleting remote branch: $BRANCH"
|
|
36
|
+
git push origin --delete "$BRANCH" 2>/dev/null || {
|
|
37
|
+
echo "⚠️ Could not delete remote branch (may already be deleted by PR)"
|
|
38
|
+
}
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# Delete local branch
|
|
42
|
+
git branch -D "$BRANCH" 2>/dev/null || echo "Local branch already deleted"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Archive Plan
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
PLAN_FILE=$(ls .claude/gitflow/plans/*${BRANCH_NAME}*.md 2>/dev/null | head -1)
|
|
49
|
+
|
|
50
|
+
if [ -f "$PLAN_FILE" ]; then
|
|
51
|
+
ARCHIVE_NAME="${PLAN_FILE%.md}_DONE_$(date +%Y%m%d-%H%M%S).md"
|
|
52
|
+
mv "$PLAN_FILE" "$ARCHIVE_NAME"
|
|
53
|
+
echo "✅ Plan archived: $ARCHIVE_NAME"
|
|
54
|
+
fi
|
|
55
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Version Bumping After Release/Hotfix
|
|
2
|
+
|
|
3
|
+
## Determine Next Version
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
MAJOR=$(echo $VERSION | cut -d'.' -f1)
|
|
7
|
+
MINOR=$(echo $VERSION | cut -d'.' -f2)
|
|
8
|
+
PATCH=$(echo $VERSION | cut -d'.' -f3)
|
|
9
|
+
|
|
10
|
+
if [ "$BRANCH_TYPE" = "release" ]; then
|
|
11
|
+
# Release: increment minor, reset patch
|
|
12
|
+
NEXT_VERSION="$MAJOR.$((MINOR + 1)).0"
|
|
13
|
+
else
|
|
14
|
+
# Hotfix: increment patch (patch was already bumped for the tag, bump again for next dev)
|
|
15
|
+
NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 2))"
|
|
16
|
+
fi
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Update Configuration and Source Files
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Update config (using resolved config path)
|
|
23
|
+
sed -i "s/\"current\": \".*\"/\"current\": \"$NEXT_VERSION\"/" "$GF_CONFIG_FILE"
|
|
24
|
+
|
|
25
|
+
# Update source files
|
|
26
|
+
# csproj, package.json, etc.
|
|
27
|
+
|
|
28
|
+
git add -A
|
|
29
|
+
git commit -m "chore: bump version to $NEXT_VERSION for development"
|
|
30
|
+
git push origin $GF_DEVELOP_BRANCH
|
|
31
|
+
|
|
32
|
+
# CRITICAL: Verify push and update tracking refs
|
|
33
|
+
git fetch origin $GF_DEVELOP_BRANCH:refs/remotes/origin/$GF_DEVELOP_BRANCH --force --quiet
|
|
34
|
+
LOCAL_SHA=$(git rev-parse HEAD)
|
|
35
|
+
REMOTE_SHA=$(git rev-parse origin/$GF_DEVELOP_BRANCH)
|
|
36
|
+
if [ "$LOCAL_SHA" = "$REMOTE_SHA" ]; then
|
|
37
|
+
echo "✅ Push verified - local/remote in sync"
|
|
38
|
+
else
|
|
39
|
+
echo "⚠️ Push verification FAILED"
|
|
40
|
+
echo " Local: $LOCAL_SHA"
|
|
41
|
+
echo " Remote: $REMOTE_SHA"
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
echo "✅ Version bumped to $NEXT_VERSION"
|
|
45
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Environment Detection
|
|
2
|
+
|
|
3
|
+
## Platform and Git Detection
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# PLATFORM DETECTION (required for correct path handling on WSL/Windows/macOS/Linux)
|
|
7
|
+
if [ -f /proc/version ] && grep -qi "microsoft\|wsl" /proc/version 2>/dev/null; then
|
|
8
|
+
GF_PLATFORM="wsl"; GF_SHELL="bash"
|
|
9
|
+
elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "mingw"* ]] || [[ "$OSTYPE" == "cygwin" ]]; then
|
|
10
|
+
GF_PLATFORM="windows"; GF_SHELL="gitbash"
|
|
11
|
+
elif [[ -n "$WINDIR" ]] || [[ -n "$SystemRoot" ]]; then
|
|
12
|
+
GF_PLATFORM="windows"; GF_SHELL="powershell"
|
|
13
|
+
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
14
|
+
GF_PLATFORM="macos"; GF_SHELL="zsh"
|
|
15
|
+
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
16
|
+
GF_PLATFORM="linux"; GF_SHELL="bash"
|
|
17
|
+
else
|
|
18
|
+
GF_PLATFORM="unknown"; GF_SHELL="bash"
|
|
19
|
+
fi
|
|
20
|
+
echo "Platform: $GF_PLATFORM ($GF_SHELL)"
|
|
21
|
+
|
|
22
|
+
# Check if we're in a git repository
|
|
23
|
+
IS_GIT_REPO=$(git rev-parse --git-dir 2>/dev/null && echo "true" || echo "false")
|
|
24
|
+
|
|
25
|
+
# Auto-detect values for defaults (will be confirmed by user)
|
|
26
|
+
DETECTED_URL=$(git remote get-url origin 2>/dev/null || echo "")
|
|
27
|
+
DETECTED_FOLDER=$(dirname "$(pwd)")
|
|
28
|
+
DETECTED_NAME=$(basename -s .git "$DETECTED_URL" 2>/dev/null || basename "$(pwd)")
|
|
29
|
+
|
|
30
|
+
# Detect git provider
|
|
31
|
+
if [[ "$DETECTED_URL" == *"github.com"* ]]; then
|
|
32
|
+
GIT_PROVIDER="github"
|
|
33
|
+
elif [[ "$DETECTED_URL" == *"dev.azure.com"* ]]; then
|
|
34
|
+
GIT_PROVIDER="azuredevops"
|
|
35
|
+
else
|
|
36
|
+
GIT_PROVIDER="unknown"
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# Check if already initialized
|
|
40
|
+
ALREADY_INITIALIZED=$([ -f ".claude/gitflow/config.json" ] && echo "true" || echo "false")
|
|
41
|
+
```
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# MANDATORY User Questions for Init
|
|
2
|
+
|
|
3
|
+
All questions must be asked in order. See step-init.md for context on when each is asked.
|
|
4
|
+
|
|
5
|
+
## Question 1: Repository URL
|
|
6
|
+
|
|
7
|
+
**⛔ ALWAYS ask, even if URL was detected:**
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
AskUserQuestion:
|
|
11
|
+
- header: "Repository"
|
|
12
|
+
question: "Repository URL? (detected: {DETECTED_URL})"
|
|
13
|
+
options:
|
|
14
|
+
- label: "Use detected URL (Recommended)"
|
|
15
|
+
description: "{DETECTED_URL}"
|
|
16
|
+
- label: "Enter GitHub URL"
|
|
17
|
+
description: "https://github.com/org/repo.git"
|
|
18
|
+
- label: "Enter Azure DevOps URL"
|
|
19
|
+
description: "https://dev.azure.com/org/project/_git/repo"
|
|
20
|
+
- label: "Local only (no remote)"
|
|
21
|
+
description: "Initialize without remote (limited features)"
|
|
22
|
+
multiSelect: false
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**⛔ FOLLOW-UP: If user selects "Enter GitHub URL" or "Enter Azure DevOps URL":**
|
|
26
|
+
|
|
27
|
+
The selected option is just a choice, NOT the actual URL. You MUST ask a follow-up question:
|
|
28
|
+
|
|
29
|
+
```yaml
|
|
30
|
+
AskUserQuestion:
|
|
31
|
+
- header: "URL"
|
|
32
|
+
question: "Enter the repository URL:"
|
|
33
|
+
options:
|
|
34
|
+
- label: "https://github.com/org/repo.git"
|
|
35
|
+
description: "Example GitHub format"
|
|
36
|
+
- label: "https://dev.azure.com/org/project/_git/repo"
|
|
37
|
+
description: "Example Azure DevOps format"
|
|
38
|
+
multiSelect: false
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The user will type the actual URL via "Other". Then:
|
|
42
|
+
- Validate format
|
|
43
|
+
- Update `{REPO_URL}` and `{GIT_PROVIDER}`
|
|
44
|
+
|
|
45
|
+
## Question 2: Root Folder
|
|
46
|
+
|
|
47
|
+
**⛔ ALWAYS ask where to create THIS project's structure:**
|
|
48
|
+
|
|
49
|
+
**If sibling projects exist, show where it fits:**
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
{WORKSPACE_DIR}/
|
|
53
|
+
├── SmartStack.app/ ✅ (gitflow)
|
|
54
|
+
├── SmartStack.mcp/ ✅ (gitflow)
|
|
55
|
+
├── SmartStack.cli/ ✅ (gitflow)
|
|
56
|
+
└── NewProject/ ← THIS PROJECT
|
|
57
|
+
├── .bare/
|
|
58
|
+
├── 01-Main/
|
|
59
|
+
├── 02-Develop/
|
|
60
|
+
├── features/
|
|
61
|
+
├── releases/
|
|
62
|
+
└── hotfixes/
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
AskUserQuestion:
|
|
67
|
+
- header: "Location"
|
|
68
|
+
question: "Root folder for THIS project? (worktrees will be created here)"
|
|
69
|
+
options:
|
|
70
|
+
- label: "Use parent folder (Recommended)"
|
|
71
|
+
description: "{DETECTED_FOLDER}/ - consistent with {#SIBLING_PROJECTS} sibling project(s)"
|
|
72
|
+
- label: "Use current folder"
|
|
73
|
+
description: "$(pwd)/ - Will create subfolders here"
|
|
74
|
+
- label: "Custom path"
|
|
75
|
+
description: "Specify a different location"
|
|
76
|
+
multiSelect: false
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**⛔ FOLLOW-UP: If user selects "Custom path":**
|
|
80
|
+
|
|
81
|
+
You MUST ask a follow-up question to get the actual path:
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
AskUserQuestion:
|
|
85
|
+
- header: "Path"
|
|
86
|
+
question: "Enter the full path for the project root folder:"
|
|
87
|
+
options:
|
|
88
|
+
- label: "{DETECTED_FOLDER}/"
|
|
89
|
+
description: "Parent of current directory"
|
|
90
|
+
- label: "{WORKSPACE_DIR}/"
|
|
91
|
+
description: "Workspace root"
|
|
92
|
+
multiSelect: false
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The user will type the actual path via "Other". Validate the path exists or can be created.
|
|
96
|
+
|
|
97
|
+
**Explain the structure that will be created for this project:**
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
{ROOT_FOLDER}/
|
|
101
|
+
├── .bare/ # Git bare repository (this repo only)
|
|
102
|
+
├── 01-Main/ # Worktree: main branch
|
|
103
|
+
├── 02-Develop/ # Worktree: develop branch
|
|
104
|
+
├── features/ # Feature branch worktrees
|
|
105
|
+
├── releases/ # Release branch worktrees
|
|
106
|
+
└── hotfixes/ # Hotfix branch worktrees
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Question 3: Project Name
|
|
110
|
+
|
|
111
|
+
**⛔ ALWAYS ask to confirm project name:**
|
|
112
|
+
|
|
113
|
+
```yaml
|
|
114
|
+
AskUserQuestion:
|
|
115
|
+
- header: "Project"
|
|
116
|
+
question: "Project name? (detected: {DETECTED_NAME})"
|
|
117
|
+
options:
|
|
118
|
+
- label: "Use detected name (Recommended)"
|
|
119
|
+
description: "Project: {DETECTED_NAME}"
|
|
120
|
+
- label: "Custom name"
|
|
121
|
+
description: "Specify a different project name"
|
|
122
|
+
multiSelect: false
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**⛔ FOLLOW-UP: If user selects "Custom name":**
|
|
126
|
+
|
|
127
|
+
You MUST ask a follow-up question to get the actual name:
|
|
128
|
+
|
|
129
|
+
```yaml
|
|
130
|
+
AskUserQuestion:
|
|
131
|
+
- header: "Name"
|
|
132
|
+
question: "Enter the project name:"
|
|
133
|
+
options:
|
|
134
|
+
- label: "{DETECTED_NAME}"
|
|
135
|
+
description: "Detected from repository"
|
|
136
|
+
- label: "{DETECTED_NAME}-v2"
|
|
137
|
+
description: "Variant of detected name"
|
|
138
|
+
multiSelect: false
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The user will type the actual name via "Other". Use this raw input for step 6b (normalization).
|
|
142
|
+
|
|
143
|
+
## Question 4: Existing Configuration
|
|
144
|
+
|
|
145
|
+
**If `ALREADY_INITIALIZED` = true:**
|
|
146
|
+
|
|
147
|
+
Display current configuration and ask what to do:
|
|
148
|
+
|
|
149
|
+
```yaml
|
|
150
|
+
AskUserQuestion:
|
|
151
|
+
- header: "Existing"
|
|
152
|
+
question: "GitFlow is already initialized. Current config will be shown. What do you want to do?"
|
|
153
|
+
options:
|
|
154
|
+
- label: "Reconfigure (Recommended)"
|
|
155
|
+
description: "Review and update all settings"
|
|
156
|
+
- label: "Repair"
|
|
157
|
+
description: "Fix missing directories only"
|
|
158
|
+
- label: "View only"
|
|
159
|
+
description: "Display current config and exit"
|
|
160
|
+
- label: "Cancel"
|
|
161
|
+
description: "Exit without changes"
|
|
162
|
+
multiSelect: false
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Handle choices:**
|
|
166
|
+
- **Reconfigure**: Continue to step 4 (will ask all questions again)
|
|
167
|
+
- **Repair**: Check directories, fix missing ones, exit
|
|
168
|
+
- **View only**: Display config, exit
|
|
169
|
+
- **Cancel**: Exit immediately
|
|
170
|
+
|
|
171
|
+
## Question 5: Worktree Mode
|
|
172
|
+
|
|
173
|
+
```yaml
|
|
174
|
+
AskUserQuestion:
|
|
175
|
+
- header: "Worktrees"
|
|
176
|
+
question: "How should worktrees be organized?"
|
|
177
|
+
options:
|
|
178
|
+
- label: "Organized (Recommended)"
|
|
179
|
+
description: "01-Main, 02-Develop, features/, releases/, hotfixes/"
|
|
180
|
+
- label: "Simple"
|
|
181
|
+
description: "main/, develop/, features/, releases/, hotfixes/"
|
|
182
|
+
- label: "Disabled"
|
|
183
|
+
description: "No worktrees, use git checkout (not recommended)"
|
|
184
|
+
multiSelect: false
|
|
185
|
+
```
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Directory Structure Creation
|
|
2
|
+
|
|
3
|
+
## Path Normalization for WSL
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# If on WSL, translate Windows paths to /mnt/ format
|
|
7
|
+
# normalize_path_for_platform() from _shared.md handles this
|
|
8
|
+
# Example: D:/projects/MyApp → /mnt/d/projects/MyApp
|
|
9
|
+
PROJECT_BASE="{ROOT_FOLDER}" # Must be already normalized for current platform
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Create Complete Structure
|
|
13
|
+
|
|
14
|
+
**⛔ CRITICAL: Use ABSOLUTE PATHS for ALL operations. NEVER use `cd` (it does not persist between Bash calls).**
|
|
15
|
+
**⛔ Use `git -C <path>` or `GIT_DIR=<path>` instead of `cd` + `git`.**
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
PROJECT_BASE="{ROOT_FOLDER}"
|
|
19
|
+
|
|
20
|
+
# Create subdirectories (absolute paths)
|
|
21
|
+
mkdir -p "$PROJECT_BASE/features" "$PROJECT_BASE/releases" "$PROJECT_BASE/hotfixes"
|
|
22
|
+
|
|
23
|
+
# Create bare repository if not exists (absolute path, no cd)
|
|
24
|
+
if [ ! -d "$PROJECT_BASE/.bare" ]; then
|
|
25
|
+
git clone --bare "{REPO_URL}" "$PROJECT_BASE/.bare"
|
|
26
|
+
|
|
27
|
+
# Configure bare repo for worktrees (using git -C, no cd)
|
|
28
|
+
git -C "$PROJECT_BASE/.bare" config core.bare false
|
|
29
|
+
git -C "$PROJECT_BASE/.bare" config core.worktree ..
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# Create .git pseudo-file pointing to .bare
|
|
33
|
+
echo "gitdir: ./.bare" > "$PROJECT_BASE/.git"
|
|
34
|
+
|
|
35
|
+
# Organized mode: numbered main folders (absolute paths, GIT_DIR instead of cd)
|
|
36
|
+
if [ "$WORKTREE_MODE" = "organized" ]; then
|
|
37
|
+
[ ! -d "$PROJECT_BASE/01-Main" ] && \
|
|
38
|
+
GIT_DIR="$PROJECT_BASE/.bare" git worktree add "$PROJECT_BASE/01-Main" main
|
|
39
|
+
|
|
40
|
+
[ ! -d "$PROJECT_BASE/02-Develop" ] && \
|
|
41
|
+
GIT_DIR="$PROJECT_BASE/.bare" git worktree add "$PROJECT_BASE/02-Develop" develop
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# Simple mode: named folders (absolute paths)
|
|
45
|
+
if [ "$WORKTREE_MODE" = "simple" ]; then
|
|
46
|
+
[ ! -d "$PROJECT_BASE/main" ] && \
|
|
47
|
+
GIT_DIR="$PROJECT_BASE/.bare" git worktree add "$PROJECT_BASE/main" main
|
|
48
|
+
|
|
49
|
+
[ ! -d "$PROJECT_BASE/develop" ] && \
|
|
50
|
+
GIT_DIR="$PROJECT_BASE/.bare" git worktree add "$PROJECT_BASE/develop" develop
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
# Convert worktree paths to relative format (cross-platform: Windows + WSL)
|
|
54
|
+
detect_platform
|
|
55
|
+
repair_worktree_paths "$PROJECT_BASE/.bare"
|
|
56
|
+
|
|
57
|
+
# Create gitflow config directory (absolute paths)
|
|
58
|
+
DEVELOP_DIR=$([ "$WORKTREE_MODE" = "organized" ] && echo "02-Develop" || echo "develop")
|
|
59
|
+
mkdir -p "$PROJECT_BASE/$DEVELOP_DIR/.claude/gitflow/plans"
|
|
60
|
+
mkdir -p "$PROJECT_BASE/$DEVELOP_DIR/.claude/gitflow/logs"
|
|
61
|
+
mkdir -p "$PROJECT_BASE/$DEVELOP_DIR/.claude/gitflow/cache"
|
|
62
|
+
mkdir -p "$PROJECT_BASE/$DEVELOP_DIR/.claude/gitflow/backup"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Folder Structure to Create
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
{ROOT_FOLDER}/
|
|
69
|
+
├── .bare/ # Git bare repository (this repo only)
|
|
70
|
+
├── 01-Main/ # Worktree: main branch
|
|
71
|
+
├── 02-Develop/ # Worktree: develop branch
|
|
72
|
+
├── features/ # Feature branch worktrees
|
|
73
|
+
├── releases/ # Release branch worktrees
|
|
74
|
+
└── hotfixes/ # Hotfix branch worktrees
|
|
75
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Version Detection
|
|
2
|
+
|
|
3
|
+
## Detect Version (with Priority)
|
|
4
|
+
|
|
5
|
+
**⛔ Use absolute paths with `git -C`, no `cd`.**
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
DEVELOP_FULL_PATH="$PROJECT_BASE/$DEVELOP_DIR"
|
|
9
|
+
|
|
10
|
+
# Priority: csproj > Directory.Build.props > package.json > VERSION > tag
|
|
11
|
+
VERSION=$(grep -oP '<Version>\K[^<]+' "$DEVELOP_FULL_PATH"/*.csproj 2>/dev/null | head -1)
|
|
12
|
+
[ -z "$VERSION" ] && VERSION=$(grep -oP '<Version>\K[^<]+' "$DEVELOP_FULL_PATH/Directory.Build.props" 2>/dev/null)
|
|
13
|
+
[ -z "$VERSION" ] && VERSION=$(grep -oP '"version":\s*"\K[^"]+' "$DEVELOP_FULL_PATH/package.json" 2>/dev/null)
|
|
14
|
+
[ -z "$VERSION" ] && VERSION=$(cat "$DEVELOP_FULL_PATH/VERSION" 2>/dev/null)
|
|
15
|
+
[ -z "$VERSION" ] && VERSION=$(git -C "$DEVELOP_FULL_PATH" describe --tags --abbrev=0 2>/dev/null | sed 's/^v//')
|
|
16
|
+
[ -z "$VERSION" ] && VERSION="0.1.0"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Version will be stored in config.json
|
|
20
|
+
|
|
21
|
+
The detected version is used in the GitFlow config template under `versioning.current`.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Workspace Detection
|
|
2
|
+
|
|
3
|
+
## Scan for Sibling Projects
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
WORKSPACE_DIR=$(dirname "$(pwd)")
|
|
7
|
+
SIBLING_PROJECTS=()
|
|
8
|
+
|
|
9
|
+
for dir in "$WORKSPACE_DIR"/*/; do
|
|
10
|
+
[ -d "$dir/.bare" ] || [ -d "$dir/01-Main" ] || [ -d "$dir/02-Develop" ] && {
|
|
11
|
+
PROJECT_NAME_SIBLING=$(basename "$dir")
|
|
12
|
+
SIBLING_PROJECTS+=("$PROJECT_NAME_SIBLING")
|
|
13
|
+
}
|
|
14
|
+
done
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Display Workspace Context
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
21
|
+
│ WORKSPACE: {WORKSPACE_DIR} │
|
|
22
|
+
├─────────────────────────────────────────────────────────────┤
|
|
23
|
+
│ Each project has its OWN independent GitFlow configuration. │
|
|
24
|
+
│ This init configures only: {DETECTED_NAME} │
|
|
25
|
+
├─────────────────────────────────────────────────────────────┤
|
|
26
|
+
{if SIBLING_PROJECTS not empty}
|
|
27
|
+
│ Existing GitFlow projects: │
|
|
28
|
+
│ {for each SIBLING} ✅ {SIBLING_NAME}/ │
|
|
29
|
+
│ ├── .bare/ 01-Main/ 02-Develop/ │
|
|
30
|
+
│ └── features/ releases/ hotfixes/ │
|
|
31
|
+
│ {end for} │
|
|
32
|
+
│ │
|
|
33
|
+
│ New project to initialize: │
|
|
34
|
+
│ ⬜ {DETECTED_NAME}/ │
|
|
35
|
+
│ └── (same structure will be created) │
|
|
36
|
+
{else}
|
|
37
|
+
│ No existing GitFlow projects detected. │
|
|
38
|
+
│ This will be the first project in this workspace. │
|
|
39
|
+
{endif}
|
|
40
|
+
└─────────────────────────────────────────────────────────────┘
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Key principle:** GitFlow is **per-repository**. Each project has its own `config.json`, its own worktree structure, and its own version history. Projects do not share configuration.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Check CI and Review Status
|
|
2
|
+
|
|
3
|
+
## Check CI Status (GitHub)
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
if [ "$GIT_PROVIDER" = "github" ]; then
|
|
7
|
+
CI_STATUS=$(gh pr checks $PR_NUMBER --json state --jq '.[].state' | sort -u)
|
|
8
|
+
|
|
9
|
+
[[ "$CI_STATUS" == *"FAILURE"* ]] && {
|
|
10
|
+
echo "❌ CI checks failing"
|
|
11
|
+
gh pr checks $PR_NUMBER
|
|
12
|
+
|
|
13
|
+
if [ "$auto_mode" != true ]; then
|
|
14
|
+
AskUserQuestion:
|
|
15
|
+
header: "CI"
|
|
16
|
+
question: "CI checks are failing. Continue anyway?"
|
|
17
|
+
options:
|
|
18
|
+
- label: "Wait for fix"
|
|
19
|
+
- label: "Merge anyway (not recommended)"
|
|
20
|
+
fi
|
|
21
|
+
}
|
|
22
|
+
fi
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Check Review Status (GitHub)
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
if [ "$GIT_PROVIDER" = "github" ]; then
|
|
29
|
+
REVIEWS=$(gh pr view $PR_NUMBER --json reviews --jq '.reviews | map(select(.state == "APPROVED")) | length')
|
|
30
|
+
REQUIRED_REVIEWS=$(gh api repos/:owner/:repo --jq '.default_branch_protection.required_pull_request_reviews.required_approving_review_count // 0')
|
|
31
|
+
|
|
32
|
+
[ "$REVIEWS" -lt "$REQUIRED_REVIEWS" ] && {
|
|
33
|
+
echo "⚠️ Needs $REQUIRED_REVIEWS approvals, has $REVIEWS"
|
|
34
|
+
}
|
|
35
|
+
fi
|
|
36
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Merge Execution and Verification
|
|
2
|
+
|
|
3
|
+
## Determine Merge Strategy
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
BRANCH_TYPE=$(echo $CURRENT | cut -d'/' -f1)
|
|
7
|
+
|
|
8
|
+
case "$BRANCH_TYPE" in
|
|
9
|
+
feature)
|
|
10
|
+
MERGE_STRATEGY="squash"
|
|
11
|
+
DELETE_BRANCH=true
|
|
12
|
+
;;
|
|
13
|
+
release|hotfix)
|
|
14
|
+
MERGE_STRATEGY="merge"
|
|
15
|
+
DELETE_BRANCH=true
|
|
16
|
+
MERGE_BACK="$GF_DEVELOP_BRANCH"
|
|
17
|
+
;;
|
|
18
|
+
esac
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Execute Merge
|
|
22
|
+
|
|
23
|
+
**GitHub:**
|
|
24
|
+
```bash
|
|
25
|
+
case "$MERGE_STRATEGY" in
|
|
26
|
+
squash)
|
|
27
|
+
gh pr merge $PR_NUMBER --squash --delete-branch
|
|
28
|
+
;;
|
|
29
|
+
merge)
|
|
30
|
+
gh pr merge $PR_NUMBER --merge --delete-branch
|
|
31
|
+
;;
|
|
32
|
+
esac
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Azure DevOps:**
|
|
36
|
+
```bash
|
|
37
|
+
case "$MERGE_STRATEGY" in
|
|
38
|
+
squash)
|
|
39
|
+
az repos pr update --id $PR_NUMBER --status completed --squash true --delete-source-branch true
|
|
40
|
+
;;
|
|
41
|
+
merge)
|
|
42
|
+
az repos pr update --id $PR_NUMBER --status completed --squash false --delete-source-branch true
|
|
43
|
+
;;
|
|
44
|
+
esac
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Verify Merge
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# CRITICAL: Force update tracking refs to get accurate state
|
|
51
|
+
git fetch origin $TARGET_BRANCH:refs/remotes/origin/$TARGET_BRANCH --force --quiet
|
|
52
|
+
git fetch origin --prune --quiet
|
|
53
|
+
|
|
54
|
+
MERGED=$(git branch -r --merged origin/$TARGET_BRANCH | grep "$CURRENT" | wc -l)
|
|
55
|
+
|
|
56
|
+
[ "$MERGED" -eq 0 ] && {
|
|
57
|
+
echo "⚠️ Merge verification failed - branch may not be merged"
|
|
58
|
+
echo " → Check PR status on remote"
|
|
59
|
+
} || {
|
|
60
|
+
echo "✅ Merge verified - branch merged to $TARGET_BRANCH"
|
|
61
|
+
}
|
|
62
|
+
```
|