@atlashub/smartstack-cli 2.8.0 → 3.0.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 (74) hide show
  1. package/.documentation/business-analyse.html +81 -17
  2. package/dist/index.js +94 -21
  3. package/dist/index.js.map +1 -1
  4. package/dist/mcp-entry.mjs +1302 -223
  5. package/dist/mcp-entry.mjs.map +1 -1
  6. package/package.json +1 -1
  7. package/templates/agents/efcore/db-deploy.md +1 -1
  8. package/templates/agents/efcore/migration.md +26 -10
  9. package/templates/agents/efcore/rebase-snapshot.md +24 -7
  10. package/templates/agents/efcore/squash.md +73 -57
  11. package/templates/agents/gitflow/commit.md +138 -18
  12. package/templates/agents/gitflow/exec.md +1 -1
  13. package/templates/agents/gitflow/finish.md +79 -62
  14. package/templates/agents/gitflow/init-clone.md +186 -0
  15. package/templates/agents/gitflow/init-detect.md +137 -0
  16. package/templates/agents/gitflow/init-validate.md +210 -0
  17. package/templates/agents/gitflow/init.md +231 -74
  18. package/templates/agents/gitflow/merge.md +65 -33
  19. package/templates/agents/gitflow/pr.md +93 -49
  20. package/templates/agents/gitflow/start.md +76 -33
  21. package/templates/agents/gitflow/status.md +41 -71
  22. package/templates/hooks/appsettings-guard.sh +76 -0
  23. package/templates/hooks/ef-migration-check.md +1 -1
  24. package/templates/hooks/hooks.json +9 -0
  25. package/templates/project/test-frontend/msw/handlers.ts +58 -0
  26. package/templates/project/test-frontend/msw/server.ts +25 -0
  27. package/templates/project/test-frontend/setup.ts +16 -0
  28. package/templates/project/test-frontend/test-utils.tsx +59 -0
  29. package/templates/project/test-frontend/vitest.config.ts +31 -0
  30. package/templates/skills/_resources/config-safety.md +61 -0
  31. package/templates/skills/_resources/formatting-guide.md +2 -2
  32. package/templates/skills/_shared.md +21 -0
  33. package/templates/skills/application/SKILL.md +32 -3
  34. package/templates/skills/application/steps/step-04-backend.md +21 -0
  35. package/templates/skills/application/steps/step-05-frontend.md +20 -36
  36. package/templates/skills/application/steps/step-07-tests.md +259 -120
  37. package/templates/skills/business-analyse/SKILL.md +57 -28
  38. package/templates/skills/business-analyse/_shared.md +70 -39
  39. package/templates/skills/business-analyse/html/ba-interactive.html +2622 -0
  40. package/templates/skills/business-analyse/questionnaire/00-application.md +123 -131
  41. package/templates/skills/business-analyse/questionnaire/01-context.md +173 -24
  42. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +170 -50
  43. package/templates/skills/business-analyse/questionnaire/03-scope.md +154 -48
  44. package/templates/skills/business-analyse/questionnaire/10-documentation.md +1 -1
  45. package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +135 -0
  46. package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +136 -0
  47. package/templates/skills/business-analyse/questionnaire.md +55 -46
  48. package/templates/skills/business-analyse/steps/step-00-init.md +24 -2
  49. package/templates/skills/business-analyse/steps/step-01-cadrage.md +31 -20
  50. package/templates/skills/business-analyse/steps/step-03-specify.md +1 -0
  51. package/templates/skills/business-analyse/steps/step-05-handoff.md +103 -1
  52. package/templates/skills/business-analyse/steps/step-06-extract.md +518 -0
  53. package/templates/skills/check-version/SKILL.md +1 -1
  54. package/templates/skills/efcore/steps/db/step-deploy.md +22 -3
  55. package/templates/skills/efcore/steps/db/step-reset.md +27 -4
  56. package/templates/skills/efcore/steps/db/step-seed.md +46 -2
  57. package/templates/skills/efcore/steps/db/step-status.md +14 -0
  58. package/templates/skills/efcore/steps/migration/step-01-check.md +31 -5
  59. package/templates/skills/efcore/steps/migration/step-02-create.md +20 -4
  60. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +60 -0
  61. package/templates/skills/efcore/steps/shared/step-00-init.md +47 -8
  62. package/templates/skills/efcore/steps/squash/step-03-create.md +27 -5
  63. package/templates/skills/gitflow/SKILL.md +91 -29
  64. package/templates/skills/gitflow/_shared.md +144 -2
  65. package/templates/skills/gitflow/phases/status.md +11 -1
  66. package/templates/skills/gitflow/steps/step-commit.md +1 -1
  67. package/templates/skills/gitflow/steps/step-init.md +202 -39
  68. package/templates/skills/gitflow/templates/config.json +10 -1
  69. package/templates/skills/ralph-loop/steps/step-03-commit.md +2 -2
  70. package/templates/skills/validate-feature/SKILL.md +83 -0
  71. package/templates/skills/validate-feature/steps/step-01-compile.md +38 -0
  72. package/templates/skills/validate-feature/steps/step-02-unit-tests.md +45 -0
  73. package/templates/skills/validate-feature/steps/step-03-integration-tests.md +53 -0
  74. package/templates/skills/validate-feature/steps/step-04-api-smoke.md +157 -0
@@ -8,55 +8,87 @@ 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. Detect Provider and Load PR Context
20
16
 
21
- ## Strategies
17
+ ```bash
18
+ REMOTE_URL=$(git remote get-url origin 2>/dev/null)
19
+ if [[ "$REMOTE_URL" == *"dev.azure.com"* ]]; then
20
+ GIT_PROVIDER="azuredevops"
21
+ else
22
+ GIT_PROVIDER="github"
23
+ fi
24
+
25
+ CURRENT=$(git rev-parse --abbrev-ref HEAD)
26
+ BRANCH_TYPE=$(echo $CURRENT | cut -d'/' -f1)
27
+
28
+ # Find PR for current branch
29
+ # GitHub: gh pr list --head "$CURRENT"
30
+ # Azure DevOps: az repos pr list --source-branch "$CURRENT"
31
+ ```
32
+
33
+ ### 2. Determine Merge Strategy
22
34
 
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 |
35
+ | Type | Strategy | Delete Branch |
36
+ |------|----------|---------------|
37
+ | Feature | squash | yes |
38
+ | Release | merge --no-ff | yes |
39
+ | Hotfix | merge --no-ff | yes |
28
40
 
29
- ## Validation Pre-Merge
41
+ ### 3. Review Checklist
30
42
 
31
- - PR approved
32
- - Checks pass (CI)
33
- - No conflicts
34
- - Version bumped (release/hotfix)
43
+ Display review checklist:
44
+ - Build status (pass/fail)
45
+ - Tests (pass/fail/none)
46
+ - Migrations (valid/invalid/none)
47
+ - Conflicts (none/detected)
48
+ - CI status (if available)
35
49
 
36
- ## Commandes
50
+ ### 4. Execute Merge
37
51
 
52
+ **GitHub:**
38
53
  ```bash
39
- # Merge avec strategie
40
- git merge --no-ff {branch} -m "Merge {type}/{name}"
54
+ # Feature (squash)
55
+ gh pr merge $PR_NUMBER --squash --delete-branch
41
56
 
42
- # Tag release
43
- git tag -a v{version} -m "Release {version}"
57
+ # Release/Hotfix (merge commit)
58
+ gh pr merge $PR_NUMBER --merge --delete-branch
59
+ ```
60
+
61
+ **Azure DevOps:**
62
+ ```bash
63
+ # Feature (squash)
64
+ az repos pr update --id $PR_ID --status completed --squash true --delete-source-branch true
65
+
66
+ # Release/Hotfix (merge commit)
67
+ az repos pr update --id $PR_ID --status completed --squash false --delete-source-branch true
68
+ ```
69
+
70
+ ### 5. Verify Merge
71
+
72
+ ```bash
73
+ # Force update tracking refs
74
+ git fetch origin $TARGET:refs/remotes/origin/$TARGET --force --quiet
75
+ git fetch origin --prune --quiet
44
76
 
45
- # Push
46
- git push origin {target} --tags
77
+ # Verify branch is merged
78
+ MERGED=$(git branch -r --merged origin/$TARGET | grep "$CURRENT" | wc -l)
47
79
  ```
48
80
 
49
- ## Output Format
81
+ ### 6. Summary
50
82
 
51
83
  ```
52
- MERGE COMPLETE
53
- Source: {branch}
54
- Target: {target}
55
- Strategy: {merge|squash}
56
- Tag: {version|none}
57
- Deleted: {branch|kept}
84
+ PR MERGED
85
+ PR: #{number}
86
+ Strategy: {squash|merge}
87
+ Target: {target}
88
+ Branch: deleted
89
+ NEXT: /gitflow finish
58
90
  ```
59
91
 
60
92
  ## Priority
61
93
 
62
- Safety > Correctness > Speed. Jamais merger si checks fail.
94
+ Safety > Correctness > Speed. Never merge if checks fail.
@@ -8,78 +8,122 @@ 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. Detect Provider and Branch Context
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)
28
- fi
29
- if [ -z "$CURRENT" ]; then
30
- CURRENT=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
31
- fi
32
-
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
20
+ # Detect provider from remote URL
21
+ REMOTE_URL=$(git remote get-url origin 2>/dev/null)
22
+ if [[ "$REMOTE_URL" == *"dev.azure.com"* ]] || [[ "$REMOTE_URL" == *"visualstudio.com"* ]]; then
23
+ GIT_PROVIDER="azuredevops"
24
+ # Extract Azure DevOps details
25
+ [[ "$REMOTE_URL" =~ dev\.azure\.com/([^/]+)/([^/]+)/_git/([^/]+) ]] && {
26
+ AZURE_ORG="${BASH_REMATCH[1]}"
27
+ AZURE_PROJECT="${BASH_REMATCH[2]}"
28
+ AZURE_REPO="${BASH_REMATCH[3]}"
29
+ }
38
30
  else
39
- TARGET="develop" # Feature → develop
31
+ GIT_PROVIDER="github"
40
32
  fi
33
+
34
+ # Get current branch (worktree-compatible)
35
+ CURRENT=$(git branch --show-current 2>/dev/null || git rev-parse --abbrev-ref HEAD)
36
+ BRANCH_TYPE=$(echo $CURRENT | cut -d'/' -f1)
37
+ BRANCH_NAME=$(echo $CURRENT | sed 's/.*\///')
41
38
  ```
42
39
 
43
- | Type | Cible | Raison |
44
- |------|-------|--------|
45
- | `feature/*` | develop | Integration continue |
46
- | `release/*` | main | Deploiement production |
47
- | `hotfix/*` | main | Correction urgente production |
40
+ ### 2. Determine Target Branch
41
+
42
+ | Type | Target | Reason |
43
+ |------|--------|--------|
44
+ | `feature/*` | develop | Continuous integration |
45
+ | `release/*` | main | Production deployment |
46
+ | `hotfix/*` | main | Urgent production fix |
48
47
 
49
- ## Commandes
48
+ ### 3. Check Prerequisites
50
49
 
51
50
  ```bash
52
- # Commits a inclure
53
- git log origin/{TARGET}..HEAD --oneline
51
+ # Ensure branch is pushed
52
+ git fetch origin
53
+ REMOTE_EXISTS=$(git branch -r --list "origin/$CURRENT")
54
+ if [ -z "$REMOTE_EXISTS" ]; then
55
+ git push -u origin $CURRENT
56
+ git fetch origin $CURRENT:refs/remotes/origin/$CURRENT --force --quiet
57
+ fi
54
58
 
55
- # Creer PR vers la cible detectee
56
- gh pr create --base $TARGET --title "{title}" --body "{body}"
59
+ # Check for uncommitted changes warn user to /gitflow commit first
60
+ # Check if PR already exists show existing PR and STOP
57
61
  ```
58
62
 
59
- ## Output Format
63
+ ### 4. Build Check
60
64
 
65
+ ```bash
66
+ # .NET project
67
+ if ls *.sln 2>/dev/null || ls src/*/*.csproj 2>/dev/null; then
68
+ dotnet build --no-restore || STOP "Build failed"
69
+
70
+ # Node.js project
71
+ elif [ -f "package.json" ]; then
72
+ npm run build || STOP "Build failed"
73
+ fi
61
74
  ```
62
- PR CREATED
63
- Branch: {branch} -> {base}
64
- Commits: {n}
65
- URL: {url}
75
+
76
+ ### 5. Generate PR Content
77
+
78
+ **Title:**
79
+ - feature → `feat: {branch-name}`
80
+ - hotfix → `fix: {branch-name}`
81
+ - release → `release: v{version}`
82
+
83
+ **Body:** Auto-generate from `git log origin/{TARGET}..HEAD --oneline`
84
+
85
+ ### 6. Create Pull Request
86
+
87
+ **GitHub:**
88
+ ```bash
89
+ gh pr create --base $TARGET --title "$TITLE" --body "$(cat <<'EOF'
90
+ {PR_BODY}
91
+ EOF
92
+ )"
93
+ PR_URL=$(gh pr view --json url --jq '.url')
66
94
  ```
67
95
 
68
- ## Template Description
96
+ **Azure DevOps:**
97
+ ```bash
98
+ az repos pr create \
99
+ --title "$TITLE" \
100
+ --description "{PR_BODY}" \
101
+ --source-branch "$CURRENT" \
102
+ --target-branch "$TARGET" \
103
+ --repository "$AZURE_REPO" \
104
+ --project "$AZURE_PROJECT" \
105
+ --org "https://dev.azure.com/$AZURE_ORG"
106
+ ```
69
107
 
70
- ```markdown
71
- ## Summary
72
- {liste des commits}
108
+ ### 7. Auto-complete with squash (Azure DevOps release/hotfix)
73
109
 
74
- ## Type
75
- {feature|hotfix|release}
110
+ For release/hotfix PRs on Azure DevOps, set auto-complete with squash merge:
111
+ ```bash
112
+ az repos pr update --id $PR_ID --auto-complete true --squash true --delete-source-branch true
113
+ ```
114
+
115
+ ### 8. Summary
76
116
 
77
- ## Checklist
78
- - [ ] Tests pass
79
- - [ ] Build OK
80
- - [ ] Migrations valid (si applicable)
117
+ ```
118
+ PR CREATED
119
+ PR: #{number}
120
+ Title: {title}
121
+ URL: {url}
122
+ Source: {branch} -> {target}
123
+ Provider: {github|azuredevops}
124
+ NEXT: Wait for review, then /gitflow merge
81
125
  ```
82
126
 
83
127
  ## Priority
84
128
 
85
- Speed > Detail. PR fonctionnelle rapidement.
129
+ 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.
@@ -8,17 +8,17 @@ tools: Bash, Read, Glob
8
8
 
9
9
  # GitFlow Status Agent
10
10
 
11
- Expert GitFlow. Affiche l'etat COMPLET du repository avec vocabulaire accessible.
11
+ Expert GitFlow. Display COMPLETE repository state with accessible vocabulary.
12
12
 
13
13
  ## Workflow
14
14
 
15
- 1. **Branches**: Lister TOUTES les branches (locales + remote) avec dernier commit
16
- 2. **Tags**: Lister TOUS les tags avec dates et branches associees
17
- 3. **Comparaisons**: Analyser les differences entre develop, main et releases
18
- 4. **EF Core**: Detecter migrations pending
19
- 5. **Output**: Affichage complet et comprehensible
15
+ 1. **Branches**: List ALL branches (local + remote) with last commit
16
+ 2. **Tags**: List ALL tags with dates
17
+ 3. **Comparisons**: Analyze differences between develop, main and releases
18
+ 4. **EF Core**: Detect pending migrations
19
+ 5. **Output**: Complete and understandable display
20
20
 
21
- ## Commandes a executer
21
+ ## Commands to Execute
22
22
 
23
23
  ```bash
24
24
  # 1. BRANCHES
@@ -32,88 +32,58 @@ git for-each-ref --sort=-v:refname --format='%(refname:short)|%(creatordate:shor
32
32
  git describe --tags --abbrev=0 main 2>/dev/null
33
33
  git describe --tags --abbrev=0 develop 2>/dev/null
34
34
 
35
- # 3. COMPARAISONS
36
- git rev-list --count main..develop 2>/dev/null # commits sur develop a publier
37
- git rev-list --count develop..main 2>/dev/null # commits sur main a recuperer
38
- git log develop..main --oneline 2>/dev/null # si main > 0
39
-
40
- # Pour chaque release/*
41
- git branch -a | grep release/
42
- # Pour chaque: ahead/behind vs develop et main
35
+ # 3. COMPARISONS
36
+ git rev-list --count main..develop 2>/dev/null
37
+ git rev-list --count develop..main 2>/dev/null
43
38
 
44
39
  # 4. STATUS
45
40
  git status --porcelain
46
41
  ```
47
42
 
48
- ## Vocabulaire simplifie (IMPORTANT)
49
-
50
- Utiliser ces termes au lieu du jargon Git:
51
- - "ahead" → "a publier" ou "prets pour production"
52
- - "behind" → "a recuperer" ou "manquants"
53
- - "diverged" → "desynchronise"
54
- - "merge" → "fusionner" ou "integrer"
55
- - "branch" → "branche" (garder)
56
- - "commit" → "changement" ou "modification"
57
- - "tag" → "version" ou "etiquette de version"
58
-
59
- ## Output Format
60
-
61
- Suivre le format defini dans la commande 2-status.md avec:
62
- - Tableaux clairs avec bordures
63
- - Legendes explicatives
64
- - Actions concretes a faire
65
- - Pas de jargon technique sans explication
66
-
67
- ## Generation des ACTIONS A FAIRE (CRITIQUE)
43
+ ## Simplified Vocabulary (IMPORTANT)
68
44
 
69
- A la fin de l'affichage, TOUJOURS generer une section "ACTIONS A FAIRE" avec des commandes PRETES A COPIER-COLLER.
45
+ Use these terms instead of Git jargon:
46
+ - "ahead" -> "to publish" / "ready for production"
47
+ - "behind" -> "to retrieve" / "missing"
48
+ - "diverged" -> "desynchronized"
49
+ - "merge" -> "integrate"
50
+ - "commit" -> "change" / "modification"
51
+ - "tag" -> "version"
70
52
 
71
- ### Regles de generation:
53
+ ## ACTIONS TO DO Generation (CRITICAL)
72
54
 
73
- 1. **Analyser l'etat** et generer UNIQUEMENT les actions pertinentes
74
- 2. **Inclure le nom exact** de la branche/feature/release dans la commande
75
- 3. **Format obligatoire** - UNE commande par ligne, facilement copiable:
55
+ At the end, ALWAYS generate an "ACTIONS TO DO" section with READY-TO-COPY commands.
76
56
 
77
- ```
78
- {emoji} {Description claire avec contexte}
79
- {commande complete prete a copier}
80
- ```
81
-
82
- **IMPORTANT**: La commande doit etre sur SA PROPRE LIGNE, sans prefixe, pour etre copiable en un clic.
57
+ ### Detection Logic:
83
58
 
84
- ### Logique de detection:
85
-
86
- | Condition detectee | Action a proposer |
59
+ | Detected Condition | Action to Propose |
87
60
  |--------------------|-------------------|
88
- | `main develop > 0` | `git merge main` |
89
- | `develop main > 0` | `/gitflow:start release v{next_version}` |
90
- | `feature/* ahead > 0 && behind == 0` | `/gitflow:finish feature/{name}` |
91
- | `feature/* behind > 5` | `/gitflow:rebase feature/{name}` |
92
- | `release/* ahead == 0` | `/gitflow:cleanup release/{name}` |
93
- | `git status dirty` | `/gitflow:commit "{contexte}"` |
94
- | `local ahead of remote` | `/gitflow:sync {branch}` |
95
- | `local behind remote` | `/gitflow:sync {branch}` |
96
- | `migrations pending` | `/efcore:db-deploy` |
97
-
98
- ### Exemple de sortie:
61
+ | `main -> develop > 0` | `git merge main` |
62
+ | `develop -> main > 0` | `/gitflow -r v{next_version}` |
63
+ | `feature/* ahead > 0 && behind == 0` | `/gitflow finish` |
64
+ | `feature/* behind > 5` | Rebase recommended |
65
+ | `release/* ahead == 0` | `/gitflow cleanup` |
66
+ | `git status dirty` | `/gitflow commit` |
67
+ | `local ahead of remote` | Push recommended |
68
+ | `local behind remote` | Pull recommended |
69
+ | `migrations pending` | Database deploy recommended |
70
+
71
+ ### Example Output:
99
72
 
100
73
  ```
101
- ══════════════════════════════════════════════════════════════════════════════
102
- ACTIONS A FAIRE
103
- ══════════════════════════════════════════════════════════════════════════════
74
+ ==============================================================================
75
+ ACTIONS TO DO
76
+ ==============================================================================
104
77
 
105
- ⚠️ Recuperer 3 commits de main dans develop
78
+ Retrieve 3 commits from main into develop
106
79
  git merge main
107
80
 
108
- 🗑️ Nettoyer release/v1.5.1 (terminee, 0 commits uniques)
109
- /gitflow:cleanup release/v1.5.1
110
-
111
- 🗑️ Nettoyer release/v1.4.2 (terminee, 0 commits uniques)
112
- /gitflow:cleanup release/v1.4.2
81
+ Clean up release/v1.5.1 (finished, 0 unique commits)
82
+ /gitflow cleanup
113
83
 
114
- ══════════════════════════════════════════════════════════════════════════════
84
+ ==============================================================================
115
85
  ```
116
86
 
117
87
  ## Priority
118
88
 
119
- Completude + Clarte > Vitesse. L'utilisateur doit comprendre TOUT l'etat du repo ET savoir exactement quoi faire ensuite.
89
+ Completeness + Clarity > Speed. User must understand the FULL repo state AND know exactly what to do next.
@@ -0,0 +1,76 @@
1
+ #!/bin/bash
2
+
3
+ # Appsettings Guard - PreToolUse Hook
4
+ # Blocks Write operations that would remove top-level sections from appsettings*.json
5
+ # Uses node -e for JSON parsing (no jq dependency)
6
+
7
+ set -euo pipefail
8
+
9
+ # Read hook input from stdin
10
+ HOOK_INPUT=$(cat)
11
+
12
+ # Quick exit: only care about appsettings*.json files (~2ms for non-matching calls)
13
+ case "$HOOK_INPUT" in
14
+ *appsettings*) ;; # proceed to full check
15
+ *) exit 0 ;; # fast exit - not an appsettings file
16
+ esac
17
+
18
+ # Full check using node (guaranteed available in SmartStack projects)
19
+ RESULT=$(echo "$HOOK_INPUT" | node -e "
20
+ const fs = require('fs');
21
+ const input = JSON.parse(fs.readFileSync(0, 'utf8'));
22
+
23
+ const toolName = input.tool_name || '';
24
+ const filePath = (input.tool_input && input.tool_input.file_path) || '';
25
+ const basename = require('path').basename(filePath);
26
+
27
+ // Only guard appsettings*.json files
28
+ if (!/^appsettings.*\.json$/i.test(basename)) {
29
+ process.exit(0);
30
+ }
31
+
32
+ // Allow creation of new files (e.g. appsettings.Local.json from /gitflow start)
33
+ if (!fs.existsSync(filePath)) {
34
+ process.exit(0);
35
+ }
36
+
37
+ // Only guard Write tool (Edit is safe by design - targeted replacement)
38
+ if (toolName !== 'Write') {
39
+ process.exit(0);
40
+ }
41
+
42
+ const newContent = (input.tool_input && input.tool_input.content) || '';
43
+
44
+ try {
45
+ const currentContent = fs.readFileSync(filePath, 'utf8');
46
+ const currentObj = JSON.parse(currentContent);
47
+ const newObj = JSON.parse(newContent);
48
+
49
+ const currentKeys = Object.keys(currentObj);
50
+ const newKeys = new Set(Object.keys(newObj));
51
+ const missing = currentKeys.filter(k => !newKeys.has(k));
52
+
53
+ if (missing.length > 0) {
54
+ const output = {
55
+ continue: true,
56
+ hookSpecificOutput: {
57
+ hookEventName: 'PreToolUse',
58
+ permissionDecision: 'block',
59
+ permissionDecisionReason: 'APPSETTINGS GUARD: Write supprimerait ' + missing.length + ' section(s) top-level: ' + missing.join(', ') + '. Utilise le tool Edit pour modifier des valeurs specifiques au lieu de reecrire le fichier entier. Si tu dois ajouter une section, utilise Edit pour inserer avant le } fermant.'
60
+ }
61
+ };
62
+ process.stdout.write(JSON.stringify(output));
63
+ process.exit(2);
64
+ }
65
+ } catch (e) {
66
+ // JSON parse error on current or new content - allow (tool will handle the error)
67
+ process.exit(0);
68
+ }
69
+ " 2>/dev/null) || true
70
+
71
+ if [ -n "$RESULT" ]; then
72
+ echo "$RESULT"
73
+ exit 2
74
+ fi
75
+
76
+ exit 0
@@ -99,7 +99,7 @@ exit 0
99
99
 
100
100
  ## Integration Claude Code
101
101
 
102
- Dans le workflow `/gitflow:3-commit`, avant le commit :
102
+ Dans le workflow `/gitflow commit`, avant le commit :
103
103
 
104
104
  ```
105
105
  1. Detecter migrations modifiees