@atlashub/smartstack-cli 2.9.0 → 3.1.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.
Files changed (90) hide show
  1. package/.documentation/agents.html +1 -371
  2. package/.documentation/business-analyse.html +81 -17
  3. package/.documentation/cli-commands.html +1 -1
  4. package/.documentation/commands.html +1 -1
  5. package/.documentation/efcore.html +1 -1
  6. package/.documentation/gitflow.html +1 -1
  7. package/.documentation/hooks.html +27 -66
  8. package/.documentation/index.html +166 -166
  9. package/.documentation/init.html +6 -7
  10. package/.documentation/installation.html +1 -1
  11. package/.documentation/ralph-loop.html +1 -9
  12. package/.documentation/test-web.html +15 -39
  13. package/dist/index.js +23 -16
  14. package/dist/index.js.map +1 -1
  15. package/dist/mcp-entry.mjs +1302 -223
  16. package/dist/mcp-entry.mjs.map +1 -1
  17. package/package.json +1 -1
  18. package/templates/agents/efcore/db-deploy.md +1 -1
  19. package/templates/agents/efcore/migration.md +26 -10
  20. package/templates/agents/efcore/rebase-snapshot.md +24 -7
  21. package/templates/agents/efcore/squash.md +73 -57
  22. package/templates/agents/gitflow/commit.md +138 -18
  23. package/templates/agents/gitflow/exec.md +1 -1
  24. package/templates/agents/gitflow/finish.md +79 -62
  25. package/templates/agents/gitflow/init-clone.md +186 -0
  26. package/templates/agents/gitflow/init-detect.md +137 -0
  27. package/templates/agents/gitflow/init-validate.md +210 -0
  28. package/templates/agents/gitflow/init.md +231 -74
  29. package/templates/agents/gitflow/merge.md +115 -33
  30. package/templates/agents/gitflow/pr.md +151 -46
  31. package/templates/agents/gitflow/start.md +76 -33
  32. package/templates/agents/gitflow/status.md +41 -71
  33. package/templates/hooks/appsettings-guard.sh +76 -0
  34. package/templates/hooks/ef-migration-check.md +1 -1
  35. package/templates/hooks/hooks.json +9 -0
  36. package/templates/project/appsettings.json.template +8 -2
  37. package/templates/project/test-frontend/msw/handlers.ts +58 -0
  38. package/templates/project/test-frontend/msw/server.ts +25 -0
  39. package/templates/project/test-frontend/setup.ts +16 -0
  40. package/templates/project/test-frontend/test-utils.tsx +59 -0
  41. package/templates/project/test-frontend/vitest.config.ts +31 -0
  42. package/templates/skills/_resources/config-safety.md +61 -0
  43. package/templates/skills/_resources/formatting-guide.md +2 -2
  44. package/templates/skills/application/SKILL.md +12 -3
  45. package/templates/skills/application/steps/step-04-backend.md +21 -0
  46. package/templates/skills/application/steps/step-07-tests.md +259 -120
  47. package/templates/skills/business-analyse/SKILL.md +57 -28
  48. package/templates/skills/business-analyse/_shared.md +70 -39
  49. package/templates/skills/business-analyse/html/ba-interactive.html +2596 -0
  50. package/templates/skills/business-analyse/questionnaire/00-application.md +123 -131
  51. package/templates/skills/business-analyse/questionnaire/01-context.md +173 -24
  52. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +170 -50
  53. package/templates/skills/business-analyse/questionnaire/03-scope.md +154 -48
  54. package/templates/skills/business-analyse/questionnaire/10-documentation.md +1 -1
  55. package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +135 -0
  56. package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +136 -0
  57. package/templates/skills/business-analyse/questionnaire.md +55 -46
  58. package/templates/skills/business-analyse/steps/step-00-init.md +24 -2
  59. package/templates/skills/business-analyse/steps/step-01-cadrage.md +31 -20
  60. package/templates/skills/business-analyse/steps/step-03-specify.md +58 -0
  61. package/templates/skills/business-analyse/steps/step-05-handoff.md +301 -1
  62. package/templates/skills/business-analyse/steps/step-06-extract.md +518 -0
  63. package/templates/skills/check-version/SKILL.md +1 -1
  64. package/templates/skills/efcore/steps/db/step-deploy.md +22 -3
  65. package/templates/skills/efcore/steps/db/step-reset.md +27 -4
  66. package/templates/skills/efcore/steps/db/step-seed.md +46 -2
  67. package/templates/skills/efcore/steps/db/step-status.md +14 -0
  68. package/templates/skills/efcore/steps/migration/step-01-check.md +31 -5
  69. package/templates/skills/efcore/steps/migration/step-02-create.md +20 -4
  70. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +60 -0
  71. package/templates/skills/efcore/steps/shared/step-00-init.md +47 -8
  72. package/templates/skills/efcore/steps/squash/step-03-create.md +27 -5
  73. package/templates/skills/gitflow/SKILL.md +91 -29
  74. package/templates/skills/gitflow/_shared.md +144 -2
  75. package/templates/skills/gitflow/phases/status.md +11 -1
  76. package/templates/skills/gitflow/steps/step-commit.md +1 -1
  77. package/templates/skills/gitflow/steps/step-init.md +202 -39
  78. package/templates/skills/gitflow/steps/step-pr.md +17 -5
  79. package/templates/skills/gitflow/templates/config.json +10 -1
  80. package/templates/skills/ralph-loop/SKILL.md +22 -15
  81. package/templates/skills/ralph-loop/steps/step-01-task.md +89 -4
  82. package/templates/skills/ralph-loop/steps/step-02-execute.md +408 -23
  83. package/templates/skills/ralph-loop/steps/step-03-commit.md +84 -2
  84. package/templates/skills/ralph-loop/steps/step-04-check.md +235 -6
  85. package/templates/skills/ralph-loop/steps/step-05-report.md +115 -0
  86. package/templates/skills/validate-feature/SKILL.md +83 -0
  87. package/templates/skills/validate-feature/steps/step-01-compile.md +38 -0
  88. package/templates/skills/validate-feature/steps/step-02-unit-tests.md +45 -0
  89. package/templates/skills/validate-feature/steps/step-03-integration-tests.md +53 -0
  90. package/templates/skills/validate-feature/steps/step-04-api-smoke.md +157 -0
@@ -8,55 +8,137 @@ tools: Bash, Read, Glob, Grep, Edit
8
8
 
9
9
  # GitFlow Merge Agent
10
10
 
11
- Merge securise avec validation complete.
11
+ Safe PR merge with review checklist. Supports GitHub and Azure DevOps.
12
12
 
13
- ## Workflow
13
+ ## EXECUTION SEQUENCE
14
14
 
15
- 1. **Verifier**: PR approved, checks pass
16
- 2. **Sync**: Fetch + rebase si necessaire
17
- 3. **Merge**: Selon strategie configuree
18
- 4. **Tag**: Si release/hotfix
19
- 5. **Cleanup**: Supprimer branche si configure
15
+ ### 1. Load GitFlow Config (MANDATORY)
20
16
 
21
- ## Strategies
17
+ ```bash
18
+ # Find and verify config exists
19
+ CONFIG_FILE=""
20
+ if [ -f ".claude/gitflow/config.json" ]; then
21
+ CONFIG_FILE=".claude/gitflow/config.json"
22
+ elif [ -f ".gitflow/config.json" ]; then
23
+ CONFIG_FILE=".gitflow/config.json"
24
+ else
25
+ # Try develop worktree
26
+ DEVELOP_PATH=$(git worktree list --porcelain 2>/dev/null | grep -A1 "branch refs/heads/develop" | grep "^worktree " | sed 's/^worktree //')
27
+ if [ -n "$DEVELOP_PATH" ] && [ -f "$DEVELOP_PATH/.claude/gitflow/config.json" ]; then
28
+ CONFIG_FILE="$DEVELOP_PATH/.claude/gitflow/config.json"
29
+ elif [ -n "$DEVELOP_PATH" ] && [ -f "$DEVELOP_PATH/.gitflow/config.json" ]; then
30
+ CONFIG_FILE="$DEVELOP_PATH/.gitflow/config.json"
31
+ fi
32
+ fi
33
+
34
+ # CRITICAL: Block if no config
35
+ if [ -z "$CONFIG_FILE" ] || [ ! -f "$CONFIG_FILE" ]; then
36
+ echo "❌ GitFlow config not found"
37
+ echo "→ Run: /gitflow init"
38
+ exit 1
39
+ fi
40
+
41
+ # Extract config values
42
+ GF_PROVIDER=$(grep -oP '"provider":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
43
+ GF_MAIN_BRANCH=$(grep -oP '"main":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
44
+ GF_DEVELOP_BRANCH=$(grep -oP '"develop":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
45
+
46
+ # Validate required values
47
+ if [ -z "$GF_MAIN_BRANCH" ] || [ -z "$GF_DEVELOP_BRANCH" ]; then
48
+ echo "❌ Invalid GitFlow config (missing branches)"
49
+ exit 1
50
+ fi
51
+ ```
52
+
53
+ ### 2. Detect Provider and Load PR Context
54
+
55
+ ```bash
56
+ # Detect provider
57
+ REMOTE_URL=$(git remote get-url origin 2>/dev/null)
58
+ if [[ "$REMOTE_URL" == *"dev.azure.com"* ]]; then
59
+ GIT_PROVIDER="azuredevops"
60
+ else
61
+ GIT_PROVIDER="github"
62
+ fi
63
+
64
+ CURRENT=$(git rev-parse --abbrev-ref HEAD)
65
+ BRANCH_TYPE=$(echo $CURRENT | cut -d'/' -f1)
66
+
67
+ # Determine target branch (using config values)
68
+ case "$BRANCH_TYPE" in
69
+ feature) TARGET="$GF_DEVELOP_BRANCH" ;;
70
+ release) TARGET="$GF_MAIN_BRANCH" ;;
71
+ hotfix) TARGET="$GF_MAIN_BRANCH" ;;
72
+ *) TARGET="$GF_DEVELOP_BRANCH" ;;
73
+ esac
74
+
75
+ echo "✓ Config loaded: $CONFIG_FILE"
76
+ echo "✓ Branch: $CURRENT → Target: $TARGET"
77
+
78
+ # Find PR for current branch
79
+ # GitHub: gh pr list --head "$CURRENT"
80
+ # Azure DevOps: az repos pr list --source-branch "$CURRENT"
81
+ ```
22
82
 
23
- | Type | Strategie |
24
- |------|-----------|
25
- | Feature | Squash ou merge --no-ff |
26
- | Release | Merge --no-ff + tag + merge to develop |
27
- | Hotfix | Merge --no-ff + tag + cherry-pick to develop |
83
+ ### 3. Determine Merge Strategy
28
84
 
29
- ## Validation Pre-Merge
85
+ | Type | Strategy | Delete Branch |
86
+ |------|----------|---------------|
87
+ | Feature | squash | yes |
88
+ | Release | merge --no-ff | yes |
89
+ | Hotfix | merge --no-ff | yes |
30
90
 
31
- - PR approved
32
- - Checks pass (CI)
33
- - No conflicts
34
- - Version bumped (release/hotfix)
91
+ ### 4. Review Checklist
35
92
 
36
- ## Commandes
93
+ Display review checklist:
94
+ - Build status (pass/fail)
95
+ - Tests (pass/fail/none)
96
+ - Migrations (valid/invalid/none)
97
+ - Conflicts (none/detected)
98
+ - CI status (if available)
37
99
 
100
+ ### 5. Execute Merge
101
+
102
+ **GitHub:**
38
103
  ```bash
39
- # Merge avec strategie
40
- git merge --no-ff {branch} -m "Merge {type}/{name}"
104
+ # Feature (squash)
105
+ gh pr merge $PR_NUMBER --squash --delete-branch
41
106
 
42
- # Tag release
43
- git tag -a v{version} -m "Release {version}"
107
+ # Release/Hotfix (merge commit)
108
+ gh pr merge $PR_NUMBER --merge --delete-branch
109
+ ```
110
+
111
+ **Azure DevOps:**
112
+ ```bash
113
+ # Feature (squash)
114
+ az repos pr update --id $PR_ID --status completed --squash true --delete-source-branch true
115
+
116
+ # Release/Hotfix (merge commit)
117
+ az repos pr update --id $PR_ID --status completed --squash false --delete-source-branch true
118
+ ```
119
+
120
+ ### 6. Verify Merge
121
+
122
+ ```bash
123
+ # Force update tracking refs
124
+ git fetch origin $TARGET:refs/remotes/origin/$TARGET --force --quiet
125
+ git fetch origin --prune --quiet
44
126
 
45
- # Push
46
- git push origin {target} --tags
127
+ # Verify branch is merged
128
+ MERGED=$(git branch -r --merged origin/$TARGET | grep "$CURRENT" | wc -l)
47
129
  ```
48
130
 
49
- ## Output Format
131
+ ### 7. Summary
50
132
 
51
133
  ```
52
- MERGE COMPLETE
53
- Source: {branch}
54
- Target: {target}
55
- Strategy: {merge|squash}
56
- Tag: {version|none}
57
- Deleted: {branch|kept}
134
+ PR MERGED
135
+ PR: #{number}
136
+ Strategy: {squash|merge}
137
+ Target: {target}
138
+ Branch: deleted
139
+ NEXT: /gitflow finish
58
140
  ```
59
141
 
60
142
  ## Priority
61
143
 
62
- Safety > Correctness > Speed. Jamais merger si checks fail.
144
+ Safety > Correctness > Speed. Never merge if checks fail.
@@ -8,78 +8,183 @@ tools: Bash, Glob
8
8
 
9
9
  # GitFlow Pull Request Agent
10
10
 
11
- Creation rapide de PR avec description auto-generee et detection automatique de la cible.
11
+ Create PR with auto-generated description, Azure DevOps and GitHub support.
12
12
 
13
- ## Workflow
13
+ > **OPTIMISED:** haiku model, reduced tools. Access to current context.
14
14
 
15
- 1. **Detecter**: Type de branche et cible automatique
16
- 2. **Analyser**: Commits depuis branche base
17
- 3. **Generer**: Titre et description
18
- 4. **Creer**: `gh pr create`
19
- 5. **Retourner**: URL de la PR
15
+ ## EXECUTION SEQUENCE
20
16
 
21
- ## Detection Cible (GitFlow Standard)
17
+ ### 1. Load GitFlow Config (MANDATORY)
22
18
 
23
19
  ```bash
24
- # Detection robuste de la branche courante (compatible worktrees)
25
- CURRENT=$(git branch --show-current 2>/dev/null)
26
- if [ -z "$CURRENT" ]; then
27
- CURRENT=$(git symbolic-ref --short HEAD 2>/dev/null)
20
+ # Find and verify config exists
21
+ CONFIG_FILE=""
22
+ if [ -f ".claude/gitflow/config.json" ]; then
23
+ CONFIG_FILE=".claude/gitflow/config.json"
24
+ elif [ -f ".gitflow/config.json" ]; then
25
+ CONFIG_FILE=".gitflow/config.json"
26
+ else
27
+ # Try develop worktree
28
+ DEVELOP_PATH=$(git worktree list --porcelain 2>/dev/null | grep -A1 "branch refs/heads/develop" | grep "^worktree " | sed 's/^worktree //')
29
+ if [ -n "$DEVELOP_PATH" ] && [ -f "$DEVELOP_PATH/.claude/gitflow/config.json" ]; then
30
+ CONFIG_FILE="$DEVELOP_PATH/.claude/gitflow/config.json"
31
+ elif [ -n "$DEVELOP_PATH" ] && [ -f "$DEVELOP_PATH/.gitflow/config.json" ]; then
32
+ CONFIG_FILE="$DEVELOP_PATH/.gitflow/config.json"
33
+ fi
28
34
  fi
29
- if [ -z "$CURRENT" ]; then
30
- CURRENT=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
35
+
36
+ # CRITICAL: Block if no config
37
+ if [ -z "$CONFIG_FILE" ] || [ ! -f "$CONFIG_FILE" ]; then
38
+ echo "❌ GitFlow config not found"
39
+ echo "→ Run: /gitflow init"
40
+ exit 1
31
41
  fi
32
42
 
33
- # Detection automatique selon le type de branche
34
- if [[ "$CURRENT" == hotfix/* ]]; then
35
- TARGET="main" # Hotfix main
36
- elif [[ "$CURRENT" == release/* ]]; then
37
- TARGET="main" # Release main
43
+ # Extract config values
44
+ GF_PROVIDER=$(grep -oP '"provider":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
45
+ GF_MAIN_BRANCH=$(grep -oP '"main":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
46
+ GF_DEVELOP_BRANCH=$(grep -oP '"develop":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
47
+ GF_REMOTE_URL=$(grep -oP '"remoteUrl":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
48
+
49
+ # Validate required values
50
+ if [ -z "$GF_MAIN_BRANCH" ] || [ -z "$GF_DEVELOP_BRANCH" ]; then
51
+ echo "❌ Invalid GitFlow config (missing branches)"
52
+ exit 1
53
+ fi
54
+ ```
55
+
56
+ ### 2. Detect Provider and Branch Context
57
+
58
+ ```bash
59
+ # Detect provider from config or remote URL
60
+ if [ -z "$GF_PROVIDER" ]; then
61
+ REMOTE_URL=$(git remote get-url origin 2>/dev/null)
62
+ if [[ "$REMOTE_URL" == *"dev.azure.com"* ]] || [[ "$REMOTE_URL" == *"visualstudio.com"* ]]; then
63
+ GIT_PROVIDER="azuredevops"
64
+ else
65
+ GIT_PROVIDER="github"
66
+ fi
38
67
  else
39
- TARGET="develop" # Feature → develop
68
+ GIT_PROVIDER="$GF_PROVIDER"
40
69
  fi
70
+
71
+ # Extract Azure DevOps details if needed
72
+ if [ "$GIT_PROVIDER" = "azuredevops" ]; then
73
+ REMOTE_URL="${GF_REMOTE_URL:-$(git remote get-url origin 2>/dev/null)}"
74
+ [[ "$REMOTE_URL" =~ dev\.azure\.com/([^/]+)/([^/]+)/_git/([^/]+) ]] && {
75
+ AZURE_ORG="${BASH_REMATCH[1]}"
76
+ AZURE_PROJECT="${BASH_REMATCH[2]}"
77
+ AZURE_REPO="${BASH_REMATCH[3]}"
78
+ }
79
+ fi
80
+
81
+ # Get current branch (worktree-compatible)
82
+ CURRENT=$(git branch --show-current 2>/dev/null || git rev-parse --abbrev-ref HEAD)
83
+ BRANCH_TYPE=$(echo $CURRENT | cut -d'/' -f1)
84
+ BRANCH_NAME=$(echo $CURRENT | sed 's/.*\///')
85
+ ```
86
+
87
+ ### 3. Determine Target Branch
88
+
89
+ ```bash
90
+ # Map branch type to target branch (using config values)
91
+ case "$BRANCH_TYPE" in
92
+ feature) TARGET="$GF_DEVELOP_BRANCH" ;;
93
+ release) TARGET="$GF_MAIN_BRANCH" ;;
94
+ hotfix) TARGET="$GF_MAIN_BRANCH" ;;
95
+ *) TARGET="$GF_DEVELOP_BRANCH" ;;
96
+ esac
97
+
98
+ echo "✓ Config loaded: $CONFIG_FILE"
99
+ echo "✓ Branch: $CURRENT (type: $BRANCH_TYPE)"
100
+ echo "✓ Target: $TARGET"
41
101
  ```
42
102
 
43
- | Type | Cible | Raison |
44
- |------|-------|--------|
45
- | `feature/*` | develop | Integration continue |
46
- | `release/*` | main | Deploiement production |
47
- | `hotfix/*` | main | Correction urgente production |
103
+ | Type | Target | Reason |
104
+ |------|--------|--------|
105
+ | `feature/*` | develop | Continuous integration |
106
+ | `release/*` | main | Production deployment |
107
+ | `hotfix/*` | main | Urgent production fix |
48
108
 
49
- ## Commandes
109
+ ### 3. Check Prerequisites
50
110
 
51
111
  ```bash
52
- # Commits a inclure
53
- git log origin/{TARGET}..HEAD --oneline
112
+ # Ensure branch is pushed
113
+ git fetch origin
114
+ REMOTE_EXISTS=$(git branch -r --list "origin/$CURRENT")
115
+ if [ -z "$REMOTE_EXISTS" ]; then
116
+ git push -u origin $CURRENT
117
+ git fetch origin $CURRENT:refs/remotes/origin/$CURRENT --force --quiet
118
+ fi
54
119
 
55
- # Creer PR vers la cible detectee
56
- gh pr create --base $TARGET --title "{title}" --body "{body}"
120
+ # Check for uncommitted changes warn user to /gitflow commit first
121
+ # Check if PR already exists show existing PR and STOP
57
122
  ```
58
123
 
59
- ## Output Format
124
+ ### 4. Build Check
60
125
 
126
+ ```bash
127
+ # .NET project
128
+ if ls *.sln 2>/dev/null || ls src/*/*.csproj 2>/dev/null; then
129
+ dotnet build --no-restore || STOP "Build failed"
130
+
131
+ # Node.js project
132
+ elif [ -f "package.json" ]; then
133
+ npm run build || STOP "Build failed"
134
+ fi
61
135
  ```
62
- PR CREATED
63
- Branch: {branch} -> {base}
64
- Commits: {n}
65
- URL: {url}
136
+
137
+ ### 5. Generate PR Content
138
+
139
+ **Title:**
140
+ - feature → `feat: {branch-name}`
141
+ - hotfix → `fix: {branch-name}`
142
+ - release → `release: v{version}`
143
+
144
+ **Body:** Auto-generate from `git log origin/{TARGET}..HEAD --oneline`
145
+
146
+ ### 6. Create Pull Request
147
+
148
+ **GitHub:**
149
+ ```bash
150
+ gh pr create --base $TARGET --title "$TITLE" --body "$(cat <<'EOF'
151
+ {PR_BODY}
152
+ EOF
153
+ )"
154
+ PR_URL=$(gh pr view --json url --jq '.url')
155
+ ```
156
+
157
+ **Azure DevOps:**
158
+ ```bash
159
+ az repos pr create \
160
+ --title "$TITLE" \
161
+ --description "{PR_BODY}" \
162
+ --source-branch "$CURRENT" \
163
+ --target-branch "$TARGET" \
164
+ --repository "$AZURE_REPO" \
165
+ --project "$AZURE_PROJECT" \
166
+ --org "https://dev.azure.com/$AZURE_ORG"
66
167
  ```
67
168
 
68
- ## Template Description
169
+ ### 7. Auto-complete with squash (Azure DevOps release/hotfix)
69
170
 
70
- ```markdown
71
- ## Summary
72
- {liste des commits}
171
+ For release/hotfix PRs on Azure DevOps, set auto-complete with squash merge:
172
+ ```bash
173
+ az repos pr update --id $PR_ID --auto-complete true --squash true --delete-source-branch true
174
+ ```
73
175
 
74
- ## Type
75
- {feature|hotfix|release}
176
+ ### 8. Summary
76
177
 
77
- ## Checklist
78
- - [ ] Tests pass
79
- - [ ] Build OK
80
- - [ ] Migrations valid (si applicable)
178
+ ```
179
+ PR CREATED
180
+ PR: #{number}
181
+ Title: {title}
182
+ URL: {url}
183
+ Source: {branch} -> {target}
184
+ Provider: {github|azuredevops}
185
+ NEXT: Wait for review, then /gitflow merge
81
186
  ```
82
187
 
83
188
  ## Priority
84
189
 
85
- Speed > Detail. PR fonctionnelle rapidement.
190
+ Speed > Detail. PR created quickly with proper target.
@@ -8,55 +8,98 @@ tools: Bash, Read, Glob, Write
8
8
 
9
9
  # GitFlow Start Agent
10
10
 
11
- Creation rapide de branche GitFlow avec worktree.
11
+ Create GitFlow branch with worktree and local environment configuration.
12
12
 
13
- ## Workflow
13
+ ## EXECUTION SEQUENCE
14
14
 
15
- 1. **Analyser**: Contexte (branche, version, ahead/behind)
16
- 2. **Choisir**: Type (feature/release/hotfix)
17
- 3. **Creer**: Worktree ou checkout
18
- 4. **Configurer**: appsettings.Local.json + launchSettings.json Local profile si .NET
19
- 5. **Configurer**: .env.local + npm run local si Web
20
- 6. **Verifier ports**: Detecter conflits entre projets
21
- 7. **Resume**: Prochaines etapes
15
+ ### 1. Analyze Context
22
16
 
23
- ## Commandes
17
+ ```bash
18
+ CURRENT_BRANCH=$(git branch --show-current)
19
+ git fetch origin --quiet
20
+
21
+ VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")
22
+ DEVELOP_AHEAD=$(git rev-list --count origin/main..origin/develop 2>/dev/null || echo "0")
23
+ DIRTY=$(git status --porcelain | wc -l)
24
+ ```
25
+
26
+ ### 2. Parse Input
27
+
28
+ | Flag | Type | Base | Target |
29
+ |------|------|------|--------|
30
+ | `-f` | feature | develop | develop |
31
+ | `-r` | release | develop | main |
32
+ | `-h` | hotfix | main | main |
33
+
34
+ If branch_type or branch_name missing, ask user via AskUserQuestion.
35
+
36
+ ### 3. Normalize and Validate
24
37
 
25
38
  ```bash
26
- # Worktree (defaut) - Structure organisee par type
27
- WORKTREE_BASE="../worktrees"
28
- mkdir -p "${WORKTREE_BASE}/${TYPE}s"
29
- WORKTREE_PATH="${WORKTREE_BASE}/${TYPE}s/${NAME}"
39
+ # kebab-case, no accents, max 50 chars
40
+ BRANCH_NAME=$(normalize "$input")
41
+ FULL_BRANCH="${type}/${BRANCH_NAME}"
30
42
 
31
- git worktree add -b {type}/{name} "$WORKTREE_PATH" origin/{base}
43
+ # Check if already exists (local or remote)
44
+ ```
32
45
 
33
- # Checkout (--no-worktree)
34
- git checkout -b {type}/{name} origin/{base}
46
+ ### 4. Create Branch + Worktree
47
+
48
+ ```bash
49
+ # Worktree paths from config or convention:
50
+ # feature → ../features/{name}
51
+ # release → ../releases/v{version}
52
+ # hotfix → ../hotfixes/{name}
53
+
54
+ git worktree add -b "$FULL_BRANCH" "$WORKTREE_PATH" "origin/$BASE_BRANCH"
55
+ ```
56
+
57
+ ### 5. Push Branch to Remote (AUTOMATIC)
58
+
59
+ ```bash
60
+ # ALWAYS push immediately after creation
61
+ cd "$WORKTREE_PATH"
62
+ git push -u origin "$FULL_BRANCH"
63
+ git fetch origin $FULL_BRANCH:refs/remotes/origin/$FULL_BRANCH --force --quiet
35
64
  ```
36
65
 
37
- ## Detection Projet .NET
66
+ ### 6. Local Environment Config
67
+
68
+ **Backend (.NET API detected):**
69
+ - Create `appsettings.Local.json` with unique DB name + port per branch
70
+ - Add `Local` profile to `launchSettings.json`
71
+
72
+ **Frontend (web project detected):**
73
+ - Create `.env.local` pointing to the API port
74
+ - Add `npm run local` script if missing
75
+
76
+ **Port allocation:** Hash branch name for unique ports (API: 5200+, Web: 5300+)
77
+
78
+ ### 7. Version Bump (Release only)
38
79
 
39
80
  ```bash
40
- # Si appsettings.json existe
41
- find . -name "appsettings.json" -not -path "*/bin/*"
81
+ # For release: bump version in source files
82
+ npm version $VERSION --no-git-tag-version # if package.json
83
+ # OR update .csproj <Version> tag
42
84
  ```
43
85
 
44
- ## Output Format
86
+ ### 8. Summary
45
87
 
46
88
  ```
47
- BRANCH CREATED
48
- Type: {feature|release|hotfix}
49
- Name: {branch}
50
- Base: {develop|main}
51
- Worktree: ../worktrees/{type}s/{name}
52
- Config: {appsettings.Local.json + launchSettings.json Local|skipped}
53
- Ports: {✓ OK|⚠️ Conflicts resolved|⚠️ Conflicts ignored}
54
-
55
- NEXT STEPS:
56
- cd ../worktrees/{type}s/{name}
57
- /efcore:db-deploy
89
+ {TYPE} CREATED
90
+ Branch: {full_branch}
91
+ Base: {base_branch}
92
+ Worktree: {worktree_path}
93
+ LOCAL ENVIRONMENT:
94
+ Database: {db_name}
95
+ API: http://localhost:{api_port}
96
+ Web: http://localhost:{web_port}
97
+ NEXT STEPS:
98
+ cd {worktree_path}
99
+ dotnet run --project src/{Project}.Api --launch-profile Local
100
+ /gitflow commit
58
101
  ```
59
102
 
60
103
  ## Priority
61
104
 
62
- Speed > Detail. Branche prete rapidement.
105
+ Speed > Detail. Branch ready quickly with local environment configured.