@atlashub/smartstack-cli 3.36.0 → 3.38.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 +201 -256
- package/dist/mcp-entry.mjs.map +1 -1
- package/package.json +3 -2
- package/scripts/extract-api-endpoints.ts +325 -0
- package/scripts/extract-business-rules.ts +440 -0
- package/scripts/generate-doc-with-mock-ui.ts +804 -0
- package/scripts/health-check.sh +168 -0
- package/scripts/postinstall.js +18 -0
- 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/gitflow/merge.md +0 -4
- package/templates/agents/gitflow/pr.md +0 -4
- package/templates/agents/gitflow/start.md +30 -5
- 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 -57
- package/templates/skills/apex/references/examine-build-validation.md +87 -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 +17 -17
- 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 +47 -249
- 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 +2 -0
- package/templates/skills/application/SKILL.md +6 -7
- 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 +120 -0
- package/templates/skills/application/references/migration-checklist-troubleshooting.md +100 -0
- package/templates/skills/application/references/nav-fallback-procedure.md +5 -6
- 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 +11 -141
- package/templates/skills/application/steps/step-01-navigation.md +3 -3
- package/templates/skills/application/steps/step-02-permissions.md +4 -4
- package/templates/skills/application/steps/step-03-roles.md +18 -175
- package/templates/skills/application/steps/step-03b-provider.md +1 -2
- package/templates/skills/application/steps/step-04-backend.md +19 -110
- package/templates/skills/application/steps/step-05-frontend.md +17 -143
- 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 +48 -48
- 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 +11 -11
- 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-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/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-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 +1 -1
- package/templates/skills/gitflow/_shared.md +23 -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 +51 -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 +71 -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 +21 -73
- package/templates/skills/review-code/references/owasp-api-top10.md +5 -5
- package/templates/skills/review-code/references/smartstack-conventions.md +11 -11
- 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 +5 -2
- 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,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,71 @@
|
|
|
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
|
+
# Create gitflow config directory (absolute paths)
|
|
54
|
+
DEVELOP_DIR=$([ "$WORKTREE_MODE" = "organized" ] && echo "02-Develop" || echo "develop")
|
|
55
|
+
mkdir -p "$PROJECT_BASE/$DEVELOP_DIR/.claude/gitflow/plans"
|
|
56
|
+
mkdir -p "$PROJECT_BASE/$DEVELOP_DIR/.claude/gitflow/logs"
|
|
57
|
+
mkdir -p "$PROJECT_BASE/$DEVELOP_DIR/.claude/gitflow/cache"
|
|
58
|
+
mkdir -p "$PROJECT_BASE/$DEVELOP_DIR/.claude/gitflow/backup"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Folder Structure to Create
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
{ROOT_FOLDER}/
|
|
65
|
+
├── .bare/ # Git bare repository (this repo only)
|
|
66
|
+
├── 01-Main/ # Worktree: main branch
|
|
67
|
+
├── 02-Develop/ # Worktree: develop branch
|
|
68
|
+
├── features/ # Feature branch worktrees
|
|
69
|
+
├── releases/ # Release branch worktrees
|
|
70
|
+
└── hotfixes/ # Hotfix branch worktrees
|
|
71
|
+
```
|
|
@@ -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
|
+
```
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Load PR Context and Load Review Checklist
|
|
2
|
+
|
|
3
|
+
## Load Config and PR Context
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# Load GitFlow config (sets GF_* variables)
|
|
7
|
+
read_gitflow_config || { echo "❌ Run /gitflow init first."; exit 1; }
|
|
8
|
+
|
|
9
|
+
CURRENT=$(git rev-parse --abbrev-ref HEAD)
|
|
10
|
+
GIT_PROVIDER="$GF_PROVIDER"
|
|
11
|
+
|
|
12
|
+
# Try loading persisted PR state first
|
|
13
|
+
CONFIG_DIR=$(dirname "$GF_CONFIG_FILE")
|
|
14
|
+
PR_STATE_FILE="$CONFIG_DIR/cache/pr-state.json"
|
|
15
|
+
if [ -f "$PR_STATE_FILE" ]; then
|
|
16
|
+
PR_NUMBER=$(grep -oP '"pr_number":\s*"\K[^"]+' "$PR_STATE_FILE" | head -1)
|
|
17
|
+
TARGET_BRANCH=$(grep -oP '"target_branch":\s*"\K[^"]+' "$PR_STATE_FILE" | head -1)
|
|
18
|
+
echo "✓ Loaded PR state from cache: PR #$PR_NUMBER → $TARGET_BRANCH"
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Fallback: query provider if no cached state
|
|
22
|
+
if [ -z "$PR_NUMBER" ]; then
|
|
23
|
+
if [ "$GIT_PROVIDER" = "github" ]; then
|
|
24
|
+
PR_NUMBER=$(gh pr list --head "$CURRENT" --json number --jq '.[0].number')
|
|
25
|
+
PR_STATUS=$(gh pr view $PR_NUMBER --json state,mergeable,reviews --jq '.')
|
|
26
|
+
elif [ "$GIT_PROVIDER" = "azuredevops" ]; then
|
|
27
|
+
PR_NUMBER=$(az repos pr list --source-branch "$CURRENT" --query "[0].pullRequestId" -o tsv)
|
|
28
|
+
PR_STATUS=$(az repos pr show --id $PR_NUMBER --query "{status:status,mergeStatus:mergeStatus}")
|
|
29
|
+
fi
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
[ -z "$PR_NUMBER" ] && {
|
|
33
|
+
echo "❌ No PR found for branch $CURRENT"
|
|
34
|
+
echo "→ Run /gitflow pr first"
|
|
35
|
+
STOP
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Display Review Checklist
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
╔══════════════════════════════════════════════════════════════════╗
|
|
43
|
+
║ PR REVIEW CHECKLIST ║
|
|
44
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
45
|
+
║ PR #${PR_NUMBER}: ${PR_TITLE} ║
|
|
46
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
47
|
+
|
|
48
|
+
## Code Quality
|
|
49
|
+
- [ ] Code follows project conventions
|
|
50
|
+
- [ ] No unnecessary complexity
|
|
51
|
+
- [ ] No code duplication
|
|
52
|
+
- [ ] Variable/function names are clear
|
|
53
|
+
|
|
54
|
+
## Security
|
|
55
|
+
- [ ] No hardcoded secrets
|
|
56
|
+
- [ ] Input validation present
|
|
57
|
+
- [ ] Authentication/authorization correct
|
|
58
|
+
- [ ] No SQL injection risks
|
|
59
|
+
|
|
60
|
+
## Testing
|
|
61
|
+
- [ ] Unit tests added/updated
|
|
62
|
+
- [ ] Integration tests pass
|
|
63
|
+
- [ ] Manual testing completed
|
|
64
|
+
|
|
65
|
+
## EF Core (if applicable)
|
|
66
|
+
- [ ] Migration files complete (3 files)
|
|
67
|
+
- [ ] No destructive operations (or confirmed)
|
|
68
|
+
- [ ] Snapshot synced with base
|
|
69
|
+
|
|
70
|
+
## Documentation
|
|
71
|
+
- [ ] Code comments where needed
|
|
72
|
+
- [ ] API docs updated (if applicable)
|
|
73
|
+
- [ ] README updated (if applicable)
|
|
74
|
+
|
|
75
|
+
╚══════════════════════════════════════════════════════════════════╝
|
|
76
|
+
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Pre-PR Build Checks
|
|
2
|
+
|
|
3
|
+
## Multi-Runtime Detection
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# Build check (multi-runtime detection)
|
|
7
|
+
echo "Running build check..."
|
|
8
|
+
if [ -f "*.sln" ] || ls *.csproj 2>/dev/null | head -1 > /dev/null; then
|
|
9
|
+
dotnet build --no-restore 2>&1 || {
|
|
10
|
+
echo "❌ .NET build failed. Fix before creating PR."
|
|
11
|
+
STOP
|
|
12
|
+
}
|
|
13
|
+
# Migration check
|
|
14
|
+
echo "Checking migrations..."
|
|
15
|
+
dotnet ef migrations list 2>&1 || echo "No migrations or EF Core not configured"
|
|
16
|
+
elif [ -f "package.json" ]; then
|
|
17
|
+
npm run build 2>&1 || {
|
|
18
|
+
echo "❌ npm build failed. Fix before creating PR."
|
|
19
|
+
STOP
|
|
20
|
+
}
|
|
21
|
+
elif [ -f "requirements.txt" ] || [ -f "pyproject.toml" ]; then
|
|
22
|
+
echo "Python project detected — skipping build check"
|
|
23
|
+
else
|
|
24
|
+
echo "⚠️ No known build system detected — skipping build check"
|
|
25
|
+
fi
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Enforce Migration Squash (Feature Branches)
|
|
29
|
+
|
|
30
|
+
**BLOCKING**: Feature branches must have at most 1 migration before creating a PR.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
if [ "$BRANCH_TYPE" = "feature" ]; then
|
|
34
|
+
MIGRATION_DIR=$(find . -path "*/Persistence/Migrations" -type d 2>/dev/null | head -1)
|
|
35
|
+
if [ -n "$MIGRATION_DIR" ]; then
|
|
36
|
+
# Count migration .cs files added by this feature (not in target branch)
|
|
37
|
+
NEW_MIGRATIONS=$(git diff --name-only "origin/$TARGET_BRANCH...HEAD" -- "$MIGRATION_DIR" \
|
|
38
|
+
| grep -E '\.cs$' \
|
|
39
|
+
| grep -v 'Designer\|ModelSnapshot' \
|
|
40
|
+
| wc -l)
|
|
41
|
+
|
|
42
|
+
if [ "$NEW_MIGRATIONS" -gt 1 ]; then
|
|
43
|
+
echo ""
|
|
44
|
+
echo "❌ MULTIPLE MIGRATIONS DETECTED ($NEW_MIGRATIONS migrations)"
|
|
45
|
+
echo "→ Feature branches must have exactly 1 migration (squashed) before PR"
|
|
46
|
+
echo "→ Run: /efcore squash"
|
|
47
|
+
echo ""
|
|
48
|
+
echo "Migrations found:"
|
|
49
|
+
git diff --name-only "origin/$TARGET_BRANCH...HEAD" -- "$MIGRATION_DIR" \
|
|
50
|
+
| grep -E '\.cs$' \
|
|
51
|
+
| grep -v 'Designer\|ModelSnapshot'
|
|
52
|
+
STOP
|
|
53
|
+
elif [ "$NEW_MIGRATIONS" -eq 1 ]; then
|
|
54
|
+
echo "✓ Single migration detected (squashed)"
|
|
55
|
+
else
|
|
56
|
+
echo "✓ No migrations in this feature"
|
|
57
|
+
fi
|
|
58
|
+
fi
|
|
59
|
+
fi
|
|
60
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Pull Request Content Generation
|
|
2
|
+
|
|
3
|
+
## Generate PR Title
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
BRANCH_NAME=$(echo $CURRENT | sed 's/.*\///')
|
|
7
|
+
BRANCH_TYPE=$(echo $CURRENT | cut -d'/' -f1)
|
|
8
|
+
|
|
9
|
+
case "$BRANCH_TYPE" in
|
|
10
|
+
feature) TITLE="feat: $BRANCH_NAME" ;;
|
|
11
|
+
hotfix) TITLE="fix: $BRANCH_NAME" ;;
|
|
12
|
+
release) TITLE="release: v$GF_VERSION" ;;
|
|
13
|
+
esac
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Generate PR Body
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
## Summary
|
|
20
|
+
|
|
21
|
+
{Auto-generated from commit messages}
|
|
22
|
+
|
|
23
|
+
## Changes
|
|
24
|
+
|
|
25
|
+
{List of files changed with categories}
|
|
26
|
+
|
|
27
|
+
## Testing
|
|
28
|
+
|
|
29
|
+
- [ ] Build passes
|
|
30
|
+
- [ ] Unit tests pass
|
|
31
|
+
- [ ] Manual testing completed
|
|
32
|
+
|
|
33
|
+
## EF Core Migrations
|
|
34
|
+
|
|
35
|
+
{Migration status: None | Added | Modified}
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
🤖 Generated with [Claude Code](https://claude.ai/code)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Persist PR Info for Merge Step
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Persist PR info for merge step (uses config path for portability)
|
|
46
|
+
CONFIG_DIR=$(dirname "$GF_CONFIG_FILE")
|
|
47
|
+
cat > "$CONFIG_DIR/cache/pr-state.json" << EOF
|
|
48
|
+
{
|
|
49
|
+
"pr_number": "$PR_NUMBER",
|
|
50
|
+
"pr_url": "$PR_URL",
|
|
51
|
+
"source_branch": "$CURRENT",
|
|
52
|
+
"target_branch": "$TARGET_BRANCH",
|
|
53
|
+
"git_provider": "$GIT_PROVIDER",
|
|
54
|
+
"created_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
55
|
+
}
|
|
56
|
+
EOF
|
|
57
|
+
echo "✓ PR state saved to $CONFIG_DIR/cache/pr-state.json"
|
|
58
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Branch Name Normalization and Validation
|
|
2
|
+
|
|
3
|
+
## Normalize Branch Name
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
normalize_branch_name() {
|
|
7
|
+
echo "$1" | tr '[:upper:]' '[:lower:]' | \
|
|
8
|
+
sed 'y/àâäéèêëïîôùûüçœæ/aaaeeeeiioouucoa/' | \
|
|
9
|
+
sed "s/[ _']/-/g" | sed 's/[^a-z0-9-]//g' | \
|
|
10
|
+
sed 's/--*/-/g' | sed 's/^-//;s/-$//' | cut -c1-50
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
BRANCH_NAME=$(normalize_branch_name "$branch_name")
|
|
14
|
+
FULL_BRANCH="${branch_type}/${BRANCH_NAME}"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Check if Branch Already Exists
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Check if exists
|
|
21
|
+
LOCAL_EXISTS=$(git branch --list "$FULL_BRANCH")
|
|
22
|
+
REMOTE_EXISTS=$(git branch -r --list "origin/$FULL_BRANCH")
|
|
23
|
+
|
|
24
|
+
[ -n "$LOCAL_EXISTS" ] || [ -n "$REMOTE_EXISTS" ] && {
|
|
25
|
+
echo "ERROR: Branch '$FULL_BRANCH' already exists"
|
|
26
|
+
# Options: Different name | Checkout existing | Delete and recreate
|
|
27
|
+
}
|
|
28
|
+
```
|