@atlashub/smartstack-cli 1.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 (144) hide show
  1. package/.documentation/agents.html +912 -0
  2. package/.documentation/apex.html +1014 -0
  3. package/.documentation/business-analyse.html +1074 -0
  4. package/.documentation/commands.html +676 -0
  5. package/.documentation/css/styles.css +2030 -0
  6. package/.documentation/efcore.html +2501 -0
  7. package/.documentation/gitflow.html +2053 -0
  8. package/.documentation/hooks.html +409 -0
  9. package/.documentation/index.html +319 -0
  10. package/.documentation/installation.html +458 -0
  11. package/.documentation/js/app.js +794 -0
  12. package/.documentation/test-web.html +509 -0
  13. package/README.md +90 -0
  14. package/config/default-config.json +86 -0
  15. package/config/settings.json +53 -0
  16. package/config/settings.local.example.json +16 -0
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.js +38198 -0
  19. package/dist/index.js.map +1 -0
  20. package/package.json +86 -0
  21. package/templates/agents/action.md +36 -0
  22. package/templates/agents/efcore/conflicts.md +57 -0
  23. package/templates/agents/efcore/db-deploy.md +51 -0
  24. package/templates/agents/efcore/db-reset.md +59 -0
  25. package/templates/agents/efcore/db-seed.md +56 -0
  26. package/templates/agents/efcore/db-status.md +43 -0
  27. package/templates/agents/efcore/migration.md +85 -0
  28. package/templates/agents/efcore/rebase-snapshot.md +62 -0
  29. package/templates/agents/efcore/scan.md +60 -0
  30. package/templates/agents/efcore/squash.md +67 -0
  31. package/templates/agents/explore-codebase.md +65 -0
  32. package/templates/agents/explore-docs.md +97 -0
  33. package/templates/agents/fix-grammar.md +49 -0
  34. package/templates/agents/gitflow/abort.md +45 -0
  35. package/templates/agents/gitflow/cleanup.md +85 -0
  36. package/templates/agents/gitflow/commit.md +40 -0
  37. package/templates/agents/gitflow/exec.md +48 -0
  38. package/templates/agents/gitflow/finish.md +92 -0
  39. package/templates/agents/gitflow/init.md +139 -0
  40. package/templates/agents/gitflow/merge.md +62 -0
  41. package/templates/agents/gitflow/plan.md +42 -0
  42. package/templates/agents/gitflow/pr.md +78 -0
  43. package/templates/agents/gitflow/review.md +49 -0
  44. package/templates/agents/gitflow/start.md +61 -0
  45. package/templates/agents/gitflow/status.md +32 -0
  46. package/templates/agents/snipper.md +36 -0
  47. package/templates/agents/websearch.md +46 -0
  48. package/templates/commands/_resources/formatting-guide.md +124 -0
  49. package/templates/commands/ai-prompt.md +315 -0
  50. package/templates/commands/apex/1-analyze.md +100 -0
  51. package/templates/commands/apex/2-plan.md +145 -0
  52. package/templates/commands/apex/3-execute.md +171 -0
  53. package/templates/commands/apex/4-examine.md +116 -0
  54. package/templates/commands/apex/5-tasks.md +209 -0
  55. package/templates/commands/apex.md +76 -0
  56. package/templates/commands/application/create.md +362 -0
  57. package/templates/commands/application/templates-backend.md +463 -0
  58. package/templates/commands/application/templates-frontend.md +517 -0
  59. package/templates/commands/application/templates-i18n.md +478 -0
  60. package/templates/commands/application/templates-seed.md +362 -0
  61. package/templates/commands/application.md +303 -0
  62. package/templates/commands/business-analyse/1-init.md +269 -0
  63. package/templates/commands/business-analyse/2-discover.md +520 -0
  64. package/templates/commands/business-analyse/3-analyse.md +408 -0
  65. package/templates/commands/business-analyse/4-specify.md +598 -0
  66. package/templates/commands/business-analyse/5-validate.md +326 -0
  67. package/templates/commands/business-analyse/6-handoff.md +746 -0
  68. package/templates/commands/business-analyse/7-doc-html.md +602 -0
  69. package/templates/commands/business-analyse/bug.md +325 -0
  70. package/templates/commands/business-analyse/change-request.md +368 -0
  71. package/templates/commands/business-analyse/hotfix.md +200 -0
  72. package/templates/commands/business-analyse.md +559 -0
  73. package/templates/commands/controller/create.md +216 -0
  74. package/templates/commands/controller/postman-templates.md +528 -0
  75. package/templates/commands/controller/templates.md +600 -0
  76. package/templates/commands/controller.md +278 -0
  77. package/templates/commands/debug.md +95 -0
  78. package/templates/commands/documentation/module.md +202 -0
  79. package/templates/commands/documentation/templates.md +432 -0
  80. package/templates/commands/documentation.md +190 -0
  81. package/templates/commands/efcore/_env-check.md +153 -0
  82. package/templates/commands/efcore/conflicts.md +269 -0
  83. package/templates/commands/efcore/db-deploy.md +193 -0
  84. package/templates/commands/efcore/db-reset.md +426 -0
  85. package/templates/commands/efcore/db-seed.md +326 -0
  86. package/templates/commands/efcore/db-status.md +214 -0
  87. package/templates/commands/efcore/migration.md +388 -0
  88. package/templates/commands/efcore/rebase-snapshot.md +264 -0
  89. package/templates/commands/efcore/scan.md +202 -0
  90. package/templates/commands/efcore/squash.md +298 -0
  91. package/templates/commands/efcore.md +176 -0
  92. package/templates/commands/epct.md +69 -0
  93. package/templates/commands/explain.md +186 -0
  94. package/templates/commands/explore.md +45 -0
  95. package/templates/commands/feature-full.md +267 -0
  96. package/templates/commands/gitflow/1-init.md +1038 -0
  97. package/templates/commands/gitflow/10-start.md +768 -0
  98. package/templates/commands/gitflow/11-finish.md +323 -0
  99. package/templates/commands/gitflow/12-cleanup.md +276 -0
  100. package/templates/commands/gitflow/13-sync.md +216 -0
  101. package/templates/commands/gitflow/14-rebase.md +251 -0
  102. package/templates/commands/gitflow/2-status.md +167 -0
  103. package/templates/commands/gitflow/3-commit.md +194 -0
  104. package/templates/commands/gitflow/4-plan.md +145 -0
  105. package/templates/commands/gitflow/5-exec.md +147 -0
  106. package/templates/commands/gitflow/6-abort.md +344 -0
  107. package/templates/commands/gitflow/7-pull-request.md +226 -0
  108. package/templates/commands/gitflow/8-review.md +176 -0
  109. package/templates/commands/gitflow/9-merge.md +224 -0
  110. package/templates/commands/gitflow.md +128 -0
  111. package/templates/commands/implement.md +663 -0
  112. package/templates/commands/notification.md +129 -0
  113. package/templates/commands/oneshot.md +57 -0
  114. package/templates/commands/quick-search.md +72 -0
  115. package/templates/commands/review.md +106 -0
  116. package/templates/commands/utils/test-web-config.md +160 -0
  117. package/templates/commands/utils/test-web.md +151 -0
  118. package/templates/commands/workflow.md +193 -0
  119. package/templates/gitflow/config.json +138 -0
  120. package/templates/hooks/ef-migration-check.md +139 -0
  121. package/templates/hooks/hooks.json +15 -0
  122. package/templates/skills/ai-prompt/SKILL.md +778 -0
  123. package/templates/skills/application/SKILL.md +563 -0
  124. package/templates/skills/application/templates-backend.md +450 -0
  125. package/templates/skills/application/templates-frontend.md +531 -0
  126. package/templates/skills/application/templates-i18n.md +520 -0
  127. package/templates/skills/application/templates-seed.md +647 -0
  128. package/templates/skills/business-analyse/SKILL.md +191 -0
  129. package/templates/skills/business-analyse/questionnaire.md +283 -0
  130. package/templates/skills/business-analyse/templates-frd.md +477 -0
  131. package/templates/skills/business-analyse/templates-react.md +580 -0
  132. package/templates/skills/controller/SKILL.md +240 -0
  133. package/templates/skills/controller/postman-templates.md +614 -0
  134. package/templates/skills/controller/templates.md +1468 -0
  135. package/templates/skills/documentation/SKILL.md +133 -0
  136. package/templates/skills/documentation/templates.md +476 -0
  137. package/templates/skills/feature-full/SKILL.md +838 -0
  138. package/templates/skills/notification/SKILL.md +555 -0
  139. package/templates/skills/ui-components/SKILL.md +870 -0
  140. package/templates/skills/workflow/SKILL.md +582 -0
  141. package/templates/test-web/api-health.json +38 -0
  142. package/templates/test-web/minimal.json +19 -0
  143. package/templates/test-web/npm-package.json +46 -0
  144. package/templates/test-web/seo-check.json +54 -0
@@ -0,0 +1,323 @@
1
+ ---
2
+ description: Phase 11 - Finish and finalize a GitFlow branch (tag + merge back)
3
+ agent: gitflow-finish
4
+ model: sonnet
5
+ ---
6
+
7
+ # Phase 11: FINISH - Finaliser une branche GitFlow
8
+
9
+ Tu es expert GitFlow. Finalise une branche apres merge de la PR.
10
+
11
+ **Argument:** `$ARGUMENTS` = branche a finaliser (optionnel, detecte automatiquement)
12
+
13
+ ---
14
+
15
+ ## Quand utiliser
16
+
17
+ | Situation | Action |
18
+ |-----------|--------|
19
+ | PR feature mergee | Cleanup uniquement |
20
+ | PR release mergee | Tag + merge back to develop |
21
+ | PR hotfix mergee | Tag + merge back to develop |
22
+
23
+ ---
24
+
25
+ ## Workflow
26
+
27
+ ### 1. Detecter le contexte
28
+
29
+ ```bash
30
+ # Branche courante ou argument
31
+ BRANCH=${ARGUMENTS:-$(git rev-parse --abbrev-ref HEAD)}
32
+
33
+ # Determiner le type
34
+ if [[ $BRANCH == feature/* ]]; then TYPE="feature"
35
+ elif [[ $BRANCH == release/* ]]; then TYPE="release"
36
+ elif [[ $BRANCH == hotfix/* ]]; then TYPE="hotfix"
37
+ else echo "Branche non GitFlow"; exit 1
38
+ fi
39
+ ```
40
+
41
+ ### 2. Verifier que PR est mergee
42
+
43
+ ```bash
44
+ # Chercher PR associee
45
+ gh pr list --head $BRANCH --state merged --json number,mergedAt
46
+
47
+ # Si pas mergee
48
+ if [ -z "$PR" ]; then
49
+ echo "⚠️ PR non trouvee ou non mergee"
50
+ echo "Executez d'abord: /gitflow:7-pull-request puis /gitflow:9-merge"
51
+ exit 1
52
+ fi
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Actions selon type
58
+
59
+ ### Feature (simple cleanup)
60
+
61
+ ```bash
62
+ # Detecter si on est dans un worktree et trouver le repo principal
63
+ CURRENT_DIR=$(pwd)
64
+ MAIN_WORKTREE=$(git worktree list --porcelain | grep -m1 "^worktree " | sed 's/worktree //')
65
+
66
+ # Revenir au repo principal AVANT de supprimer le worktree
67
+ cd "$MAIN_WORKTREE"
68
+
69
+ # Supprimer worktree si existe
70
+ WORKTREE_PATH="../worktrees/features/{name}"
71
+ if [ -d "$WORKTREE_PATH" ]; then
72
+ git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
73
+ fi
74
+
75
+ # Supprimer branche locale
76
+ git checkout develop
77
+ git pull origin develop
78
+ git branch -d feature/{name}
79
+
80
+ # Supprimer branche remote (si pas fait par merge)
81
+ git push origin --delete feature/{name} 2>/dev/null || true
82
+ ```
83
+
84
+ **Resume:**
85
+ ```
86
+ FEATURE FINALISEE
87
+ ────────────────────────────────
88
+ Branche: feature/{name}
89
+ Mergee: develop
90
+ PR: #{number}
91
+ Cleanup: ✓ Branche supprimee
92
+ ────────────────────────────────
93
+ ```
94
+
95
+ ---
96
+
97
+ ### Release (tag + merge back)
98
+
99
+ ```bash
100
+ # 0. Detecter si on est dans un worktree et trouver le repo principal
101
+ CURRENT_DIR=$(pwd)
102
+ MAIN_WORKTREE=$(git worktree list --porcelain | grep -m1 "^worktree " | sed 's/worktree //')
103
+
104
+ # Revenir au repo principal AVANT toute operation
105
+ cd "$MAIN_WORKTREE"
106
+
107
+ # 1. Checkout main et pull
108
+ git checkout main
109
+ git pull origin main
110
+
111
+ # 2. Creer tag
112
+ VERSION=$(echo $BRANCH | sed 's/release\/v//')
113
+ git tag -a "v$VERSION" -m "Release v$VERSION"
114
+ git push origin "v$VERSION"
115
+
116
+ # 3. Merge back to develop
117
+ git checkout develop
118
+ git pull origin develop
119
+ git merge main --no-ff -m "chore: merge release v$VERSION back to develop"
120
+ git push origin develop
121
+
122
+ # 4. Cleanup worktree + branche
123
+ WORKTREE_PATH="../worktrees/releases/v$VERSION"
124
+ if [ -d "$WORKTREE_PATH" ]; then
125
+ git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
126
+ fi
127
+ git branch -d release/v$VERSION
128
+ git push origin --delete release/v$VERSION 2>/dev/null || true
129
+ ```
130
+
131
+ **Resume:**
132
+ ```
133
+ RELEASE FINALISEE
134
+ ════════════════════════════════════════
135
+ Version: v{version}
136
+ Tag: v{version} ✓
137
+ Main: ✓ Mergee
138
+ Develop: ✓ Merge back complete
139
+
140
+ Actions effectuees:
141
+ ✓ Tag v{version} cree et pousse
142
+ ✓ Main mis a jour
143
+ ✓ Develop synchronise avec main
144
+ ✓ Branche release supprimee
145
+ ════════════════════════════════════════
146
+ ```
147
+
148
+ ---
149
+
150
+ ### Hotfix (auto-increment PATCH + tag + merge back)
151
+
152
+ ```bash
153
+ # 0. Detecter si on est dans un worktree et trouver le repo principal
154
+ CURRENT_DIR=$(pwd)
155
+ MAIN_WORKTREE=$(git worktree list --porcelain | grep -m1 "^worktree " | sed 's/worktree //')
156
+
157
+ # Revenir au repo principal AVANT toute operation
158
+ cd "$MAIN_WORKTREE"
159
+
160
+ # 1. Checkout main et pull
161
+ git checkout main
162
+ git pull origin main
163
+
164
+ # 2. AUTO-INCREMENT PATCH VERSION
165
+ # Lire la version actuelle
166
+ CURRENT_VERSION=$(cat package.json | jq -r '.version')
167
+
168
+ # Calculer la nouvelle version (PATCH increment)
169
+ # Ex: 1.7.1 → 1.7.2
170
+ NEW_VERSION=$(node -e "
171
+ const [major, minor, patch] = '$CURRENT_VERSION'.split('.').map(Number);
172
+ console.log([major, minor, patch + 1].join('.'));
173
+ ")
174
+
175
+ # Mettre a jour package.json avec la nouvelle version
176
+ npm version $NEW_VERSION --no-git-tag-version
177
+
178
+ # Committer le bump de version
179
+ git add package.json package-lock.json
180
+ git commit -m "chore: bump version to $NEW_VERSION"
181
+
182
+ # 3. Creer tag avec la nouvelle version
183
+ git tag -a "v$NEW_VERSION" -m "Hotfix v$NEW_VERSION"
184
+ git push origin main
185
+ git push origin "v$NEW_VERSION"
186
+
187
+ # 4. Merge back to develop
188
+ git checkout develop
189
+ git pull origin develop
190
+ git merge main --no-ff -m "chore: merge hotfix v$NEW_VERSION back to develop"
191
+ git push origin develop
192
+
193
+ # 5. Cleanup worktree + branche
194
+ WORKTREE_PATH="../worktrees/hotfixes/{name}"
195
+ if [ -d "$WORKTREE_PATH" ]; then
196
+ git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
197
+ fi
198
+ git branch -d hotfix/{name}
199
+ git push origin --delete hotfix/{name} 2>/dev/null || true
200
+ ```
201
+
202
+ **⚠️ IMPORTANT:** Le bump de version PATCH est automatique. Pas besoin de le faire manuellement avant le finish.
203
+
204
+ **Resume:**
205
+ ```
206
+ HOTFIX FINALISE
207
+ ════════════════════════════════════════
208
+ Hotfix: {name}
209
+ Version: v{CURRENT_VERSION} → v{NEW_VERSION}
210
+ Tag: v{NEW_VERSION} ✓
211
+
212
+ Actions effectuees:
213
+ ✓ Version incrementee (PATCH): {CURRENT_VERSION} → {NEW_VERSION}
214
+ ✓ package.json mis a jour
215
+ ✓ Tag v{NEW_VERSION} cree et pousse
216
+ ✓ Main mis a jour
217
+ ✓ Develop synchronise (merge back)
218
+ ✓ Branche hotfix supprimee
219
+ ════════════════════════════════════════
220
+ ```
221
+
222
+ ---
223
+
224
+ ## Gestion des conflits (merge back)
225
+
226
+ Si conflit lors du merge back to develop :
227
+
228
+ ```
229
+ ⚠️ CONFLIT DETECTE - MERGE BACK
230
+ ────────────────────────────────
231
+ Le merge de main vers develop a des conflits.
232
+
233
+ Fichiers en conflit:
234
+ {liste fichiers}
235
+
236
+ Options:
237
+ 1. Resoudre manuellement puis: git merge --continue
238
+ 2. Annuler: git merge --abort
239
+
240
+ Commande recommandee:
241
+ Resoudre conflits dans IDE
242
+ git add .
243
+ git merge --continue
244
+ git push origin develop
245
+ ────────────────────────────────
246
+ ```
247
+
248
+ ---
249
+
250
+ ## Cleanup automatique des worktrees
251
+
252
+ Apres chaque finish, un cleanup cible est effectue pour le worktree de la branche finalisee:
253
+
254
+ ```bash
255
+ # Fonction de cleanup cible (appelee automatiquement)
256
+ cleanup_worktree_for_branch() {
257
+ BRANCH=$1
258
+ WORKTREE_BASE="../worktrees"
259
+
260
+ # Determiner le chemin selon le type
261
+ if [[ $BRANCH == feature/* ]]; then
262
+ NAME=${BRANCH#feature/}
263
+ WORKTREE_PATH="$WORKTREE_BASE/features/$NAME"
264
+ elif [[ $BRANCH == release/* ]]; then
265
+ VERSION=${BRANCH#release/}
266
+ WORKTREE_PATH="$WORKTREE_BASE/releases/$VERSION"
267
+ elif [[ $BRANCH == hotfix/* ]]; then
268
+ NAME=${BRANCH#hotfix/}
269
+ WORKTREE_PATH="$WORKTREE_BASE/hotfixes/$NAME"
270
+ fi
271
+
272
+ # Supprimer si existe
273
+ if [ -d "$WORKTREE_PATH" ]; then
274
+ git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
275
+ rm -rf "$WORKTREE_PATH" 2>/dev/null || true
276
+ git worktree prune
277
+ echo "✓ Worktree nettoye: $WORKTREE_PATH"
278
+ fi
279
+ }
280
+
281
+ # Appel automatique
282
+ cleanup_worktree_for_branch "$BRANCH"
283
+ ```
284
+
285
+ **Note:** Pour un audit complet de tous les worktrees, utilisez:
286
+
287
+ ```
288
+ /gitflow:12-cleanup
289
+ ```
290
+
291
+ ---
292
+
293
+ ## Resume final
294
+
295
+ ```
296
+ GITFLOW FINISH COMPLETE
297
+ ════════════════════════════════════════
298
+ Type: {feature|release|hotfix}
299
+ Branche: {branch_name}
300
+ Status: FINALISEE
301
+
302
+ Resultats:
303
+ PR: #{number} (mergee)
304
+ Tag: {tag|N/A}
305
+ Main: {updated|N/A}
306
+ Develop: {updated|unchanged}
307
+ Cleanup: ✓ Branche supprimee
308
+ Worktree: ✓ Nettoye
309
+
310
+ ════════════════════════════════════════
311
+ Workflow GitFlow complete!
312
+ ```
313
+
314
+ ---
315
+
316
+ ## Modes
317
+
318
+ | Commande | Action |
319
+ |----------|--------|
320
+ | `/gitflow:11-finish` | Finaliser branche courante |
321
+ | `/gitflow:11-finish feature/xxx` | Finaliser branche specifiee |
322
+ | `/gitflow:11-finish --dry-run` | Simulation |
323
+ | `/gitflow:11-finish --skip-tag` | Sans creation de tag |
@@ -0,0 +1,276 @@
1
+ ---
2
+ description: Phase 12 - Cleanup worktrees and orphan branches (audit and remove)
3
+ agent: gitflow-cleanup
4
+ model: sonnet
5
+ ---
6
+
7
+ # Phase 12: CLEANUP - Audit et nettoyage des worktrees
8
+
9
+ Tu es expert GitFlow. Audite et nettoie les worktrees orphelins ou obsoletes.
10
+
11
+ **Argument:** `$ARGUMENTS` = options (--dry-run, --force, --stale-days=N)
12
+
13
+ ---
14
+
15
+ ## Prerequis
16
+
17
+ **IMPORTANT:** Cette commande doit etre executee depuis `main` ou `develop` uniquement.
18
+
19
+ ```bash
20
+ CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
21
+ if [[ "$CURRENT_BRANCH" != "main" && "$CURRENT_BRANCH" != "develop" ]]; then
22
+ echo "⚠️ ERREUR: Cette commande doit etre executee depuis main ou develop"
23
+ echo "Branche courante: $CURRENT_BRANCH"
24
+ echo ""
25
+ echo "Executez: git checkout develop && /gitflow:12-cleanup"
26
+ exit 1
27
+ fi
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Workflow
33
+
34
+ ### 1. Collecter les informations
35
+
36
+ ```bash
37
+ # Lister tous les worktrees
38
+ git worktree list --porcelain
39
+
40
+ # Lister toutes les branches locales
41
+ git branch -a
42
+
43
+ # Lister les branches remote
44
+ git fetch --prune
45
+ git branch -r
46
+ ```
47
+
48
+ ### 2. Analyser chaque worktree
49
+
50
+ Pour chaque worktree detecte:
51
+
52
+ | Verification | Condition | Status |
53
+ |--------------|-----------|--------|
54
+ | Branche existe localement | `git branch --list $BRANCH` | ✓ Active / ✗ Orphelin |
55
+ | Branche existe sur remote | `git branch -r --list origin/$BRANCH` | ✓ Trackee / ✗ Locale only |
56
+ | Derniere activite | `git log -1 --format=%ci $BRANCH` | Date dernier commit |
57
+ | Modifications non commitees | `git -C $WORKTREE status --porcelain` | ✓ Clean / ⚠️ Dirty |
58
+
59
+ ### 3. Categoriser les worktrees
60
+
61
+ ```
62
+ AUDIT WORKTREES
63
+ ═══════════════════════════════════════════════════════════════
64
+
65
+ 📁 Worktrees permanents (proteges):
66
+ ✓ ../worktrees/main → main
67
+ ✓ ../worktrees/develop → develop
68
+
69
+ 📁 Worktrees actifs:
70
+ ✓ ../worktrees/features/xxx → feature/xxx (3 jours)
71
+ ✓ ../worktrees/releases/v2 → release/v2.0.0 (1 jour)
72
+
73
+ ⚠️ Worktrees orphelins (branche supprimee):
74
+ ✗ ../worktrees/features/old → feature/old (BRANCHE INEXISTANTE)
75
+ ✗ ../worktrees/hotfixes/fix → hotfix/fix (BRANCHE INEXISTANTE)
76
+
77
+ ⏰ Worktrees stale (inactifs > {N} jours):
78
+ ⚠ ../worktrees/features/abc → feature/abc (45 jours sans commit)
79
+
80
+ 💾 Worktrees dirty (modifications non commitees):
81
+ ⚠ ../worktrees/features/wip → feature/wip (fichiers modifies)
82
+
83
+ ═══════════════════════════════════════════════════════════════
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Actions proposees
89
+
90
+ ### Mode par defaut (interactif)
91
+
92
+ ```
93
+ ACTIONS PROPOSEES
94
+ ═══════════════════════════════════════════════════════════════
95
+
96
+ Orphelins a supprimer:
97
+ [1] ../worktrees/features/old (branche inexistante)
98
+ [2] ../worktrees/hotfixes/fix (branche inexistante)
99
+
100
+ Stale a examiner (> 30 jours):
101
+ [3] ../worktrees/features/abc (45 jours)
102
+
103
+ Options:
104
+ [A] Supprimer tous les orphelins
105
+ [S] Supprimer tous les stale
106
+ [1-N] Supprimer individuellement
107
+ [D] Details sur un worktree
108
+ [Q] Quitter sans action
109
+
110
+ Choix: _
111
+ ═══════════════════════════════════════════════════════════════
112
+ ```
113
+
114
+ ### Mode --dry-run
115
+
116
+ Affiche uniquement l'audit sans proposer d'actions.
117
+
118
+ ### Mode --force
119
+
120
+ Supprime automatiquement tous les orphelins sans confirmation.
121
+
122
+ ---
123
+
124
+ ## Suppression d'un worktree
125
+
126
+ ```bash
127
+ # Verifier si dirty
128
+ if [ -n "$(git -C $WORKTREE_PATH status --porcelain)" ]; then
129
+ echo "⚠️ Worktree dirty - modifications non commitees"
130
+ echo "Utilisez --force pour supprimer quand meme"
131
+ exit 1
132
+ fi
133
+
134
+ # Supprimer le worktree
135
+ git worktree remove "$WORKTREE_PATH" --force
136
+
137
+ # Nettoyer le dossier si reste
138
+ rm -rf "$WORKTREE_PATH" 2>/dev/null || true
139
+
140
+ # Pruner les worktrees
141
+ git worktree prune
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Detection des dossiers orphelins
147
+
148
+ En plus des worktrees git, detecter les dossiers qui ne sont plus lies:
149
+
150
+ ```bash
151
+ # Lister les worktrees connus
152
+ KNOWN_WORKTREES=$(git worktree list --porcelain | grep "^worktree " | sed 's/worktree //')
153
+
154
+ # Scanner les dossiers de worktrees
155
+ WORKTREE_BASE="../worktrees"
156
+ for TYPE in features releases hotfixes; do
157
+ for DIR in "$WORKTREE_BASE/$TYPE"/*; do
158
+ if [ -d "$DIR" ]; then
159
+ # Verifier si c'est un worktree connu
160
+ if ! echo "$KNOWN_WORKTREES" | grep -q "$DIR"; then
161
+ echo "⚠️ Dossier orphelin: $DIR"
162
+ fi
163
+ fi
164
+ done
165
+ done
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Resume final
171
+
172
+ ```
173
+ CLEANUP COMPLETE
174
+ ═══════════════════════════════════════════════════════════════
175
+
176
+ Worktrees analyses: {total}
177
+ Permanents (proteges): {n_permanent}
178
+ Actifs: {n_active}
179
+ Supprimes: {n_deleted}
180
+ - Orphelins: {n_orphan}
181
+ - Stale: {n_stale}
182
+ Ignores (dirty): {n_dirty}
183
+
184
+ Espace libere: ~{size} MB
185
+
186
+ Dossiers orphelins: {n_orphan_dirs}
187
+ - Supprimes: {n_orphan_dirs_deleted}
188
+
189
+ ═══════════════════════════════════════════════════════════════
190
+ Environnement propre!
191
+ ```
192
+
193
+ ---
194
+
195
+ ## Modes
196
+
197
+ | Commande | Action |
198
+ |----------|--------|
199
+ | `/gitflow:12-cleanup` | Audit interactif avec propositions |
200
+ | `/gitflow:12-cleanup --dry-run` | Audit seul, aucune action |
201
+ | `/gitflow:12-cleanup --force` | Supprime tous les orphelins automatiquement |
202
+ | `/gitflow:12-cleanup --stale-days=30` | Seuil pour worktrees stale (defaut: 30) |
203
+ | `/gitflow:12-cleanup --include-stale` | Inclut les stale dans la suppression auto |
204
+ | `/gitflow:12-cleanup --verbose` | Affiche les details de chaque worktree |
205
+
206
+ ---
207
+
208
+ ## Integration automatique
209
+
210
+ Cette commande est appelee automatiquement par:
211
+ - `/gitflow:11-finish` → Apres finalisation d'une branche
212
+ - `/gitflow:6-abort --branch` → Apres abandon d'une branche
213
+
214
+ Dans ces cas, seul le worktree de la branche concernee est nettoye (cleanup cible).
215
+
216
+ ---
217
+
218
+ ## Cleanup cible (usage interne)
219
+
220
+ Quand appelee depuis finish/abort avec une branche specifique:
221
+
222
+ ```bash
223
+ # Usage interne
224
+ cleanup_worktree_for_branch() {
225
+ BRANCH=$1
226
+ WORKTREE_BASE="../worktrees"
227
+
228
+ # Determiner le chemin selon le type
229
+ if [[ $BRANCH == feature/* ]]; then
230
+ NAME=${BRANCH#feature/}
231
+ WORKTREE_PATH="$WORKTREE_BASE/features/$NAME"
232
+ elif [[ $BRANCH == release/* ]]; then
233
+ VERSION=${BRANCH#release/}
234
+ WORKTREE_PATH="$WORKTREE_BASE/releases/$VERSION"
235
+ elif [[ $BRANCH == hotfix/* ]]; then
236
+ NAME=${BRANCH#hotfix/}
237
+ WORKTREE_PATH="$WORKTREE_BASE/hotfixes/$NAME"
238
+ fi
239
+
240
+ # Supprimer si existe
241
+ if [ -d "$WORKTREE_PATH" ]; then
242
+ git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
243
+ rm -rf "$WORKTREE_PATH" 2>/dev/null || true
244
+ git worktree prune
245
+ echo "✓ Worktree nettoye: $WORKTREE_PATH"
246
+ fi
247
+ }
248
+ ```
249
+
250
+ ---
251
+
252
+ ## Logs
253
+
254
+ Chaque cleanup est logue dans `.claude/gitflow/logs/cleanup_{timestamp}.json`:
255
+
256
+ ```json
257
+ {
258
+ "timestamp": "{ISO_DATE}",
259
+ "type": "cleanup",
260
+ "mode": "interactive|dry-run|force|targeted",
261
+ "branch": "{main|develop}",
262
+ "worktrees": {
263
+ "analyzed": {n},
264
+ "deleted": [
265
+ { "path": "...", "branch": "...", "reason": "orphan|stale" }
266
+ ],
267
+ "skipped": [
268
+ { "path": "...", "branch": "...", "reason": "dirty|active|permanent" }
269
+ ]
270
+ },
271
+ "orphan_dirs": {
272
+ "found": {n},
273
+ "deleted": {n}
274
+ }
275
+ }
276
+ ```