@atlashub/smartstack-cli 1.23.0 → 1.24.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 (33) hide show
  1. package/dist/index.js +13 -0
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/skills/check-version/SKILL.md +183 -0
  5. package/templates/skills/debug/SKILL.md +161 -0
  6. package/templates/skills/explore/SKILL.md +96 -0
  7. package/templates/skills/quick-search/SKILL.md +87 -0
  8. package/templates/skills/refactor/SKILL.md +219 -0
  9. package/templates/skills/review-code/SKILL.md +72 -44
  10. package/templates/skills/review-code/references/smartstack-conventions.md +93 -33
  11. package/templates/skills/ui-components/responsive-guidelines.md +278 -0
  12. package/templates/skills/utils/SKILL.md +37 -0
  13. package/templates/{commands/utils → skills/utils/subcommands}/test-web-config.md +35 -43
  14. package/templates/{commands/utils → skills/utils/subcommands}/test-web.md +25 -53
  15. package/templates/{commands/validate.md → skills/validate/SKILL.md} +80 -139
  16. package/templates/commands/check-version.md +0 -267
  17. package/templates/commands/debug.md +0 -95
  18. package/templates/commands/efcore/_env-check.md +0 -153
  19. package/templates/commands/efcore/_shared.md +0 -352
  20. package/templates/commands/efcore/conflicts.md +0 -90
  21. package/templates/commands/efcore/db-deploy.md +0 -109
  22. package/templates/commands/efcore/db-reset.md +0 -180
  23. package/templates/commands/efcore/db-seed.md +0 -103
  24. package/templates/commands/efcore/db-status.md +0 -102
  25. package/templates/commands/efcore/migration.md +0 -186
  26. package/templates/commands/efcore/rebase-snapshot.md +0 -172
  27. package/templates/commands/efcore/scan.md +0 -94
  28. package/templates/commands/efcore/squash.md +0 -329
  29. package/templates/commands/efcore.md +0 -96
  30. package/templates/commands/explore.md +0 -45
  31. package/templates/commands/quick-search.md +0 -72
  32. package/templates/commands/refactor.md +0 -164
  33. /package/templates/{commands → skills}/_resources/formatting-guide.md +0 -0
@@ -1,180 +0,0 @@
1
- ---
2
- description: Completely reset database (Drop + Recreate + Migrations)
3
- agent: efcore-db-reset
4
- model: sonnet
5
- ---
6
-
7
- # EF Core Database Reset
8
-
9
- > **Ref:** [_shared.md](_shared.md)
10
- > **WARNING:** SUPPRIME TOUTES LES DONNÉES!
11
-
12
- ---
13
-
14
- ## Conformité
15
-
16
- | ❌ INTERDIT | ✅ OBLIGATOIRE |
17
- |-------------|----------------|
18
- | `sqlcmd` pour DDL/DML | `dotnet ef database drop` |
19
- | Scripts .sql dans repo | `dotnet ef database update` |
20
- | INSERT via scripts | `HasData()` pour seeding |
21
-
22
- **Exception:** `sqlcmd` est autorisé UNIQUEMENT pour `BACKUP DATABASE`.
23
-
24
- ---
25
-
26
- ## STEP 0: Vérification Environnement
27
-
28
- ```bash
29
- detect_environment
30
- block_production # BLOQUANT si Production
31
- ```
32
-
33
- Afficher: base qui sera supprimée (SERVER, DATABASE).
34
-
35
- ---
36
-
37
- ## STEP 1: Confirmation
38
-
39
- ```javascript
40
- AskUserQuestion({
41
- questions: [{
42
- question: "DANGER: Supprimer DÉFINITIVEMENT '" + DATABASE_NAME + "'? TOUTES LES DONNÉES SERONT PERDUES!",
43
- header: "Reset DB",
44
- options: [
45
- { label: "Oui, supprimer " + DATABASE_NAME, description: "Drop + Recreate (IRRÉVERSIBLE)" },
46
- { label: "Non, annuler", description: "Conserver la base" }
47
- ],
48
- multiSelect: false
49
- }]
50
- })
51
- ```
52
-
53
- ---
54
-
55
- ## STEP 2: Backup (automatique si configuré)
56
-
57
- Lire config: `.claude/gitflow/config.json` → `efcore.database.backupBeforeReset`
58
-
59
- ```javascript
60
- AskUserQuestion({
61
- questions: [{
62
- question: "Backup de la base '" + DATABASE_NAME + "' avant suppression?",
63
- header: "Backup",
64
- options: [
65
- { label: "Oui, backup auto (Recommandé)", description: "Créer .bak via sqlcmd" },
66
- { label: "Non", description: "Données dev uniquement - continuer" },
67
- { label: "Backup manuel", description: "Via SSMS/Azure Portal (stoppe ici)" }
68
- ],
69
- multiSelect: false
70
- }]
71
- })
72
- ```
73
-
74
- **Si "Oui, backup auto":**
75
-
76
- ```bash
77
- backup_database # Fonction de _shared.md
78
- ```
79
-
80
- **Si "Backup manuel":** Afficher instructions et stopper.
81
-
82
- ---
83
-
84
- ## STEP 2.5: Détection DbContext
85
-
86
- ```bash
87
- detect_efcore_project # Appelle detect_dbcontext() automatiquement
88
- echo "DbContext: $DBCONTEXT"
89
- ```
90
-
91
- **Si DbContext non détecté ou plusieurs contextes :**
92
-
93
- ```javascript
94
- AskUserQuestion({
95
- questions: [{
96
- question: "Quel DbContext reset ? (ou 'both' pour les deux)",
97
- header: "DbContext",
98
- options: [
99
- { label: "CoreDbContext", description: "Reset schéma core uniquement" },
100
- { label: "ExtensionsDbContext", description: "Reset schéma extensions uniquement" },
101
- { label: "Les deux", description: "Reset complet (core + extensions)" }
102
- ],
103
- multiSelect: false
104
- }]
105
- })
106
- ```
107
-
108
- ---
109
-
110
- ## STEP 3: Drop Database
111
-
112
- ```bash
113
- dotnet ef database drop \
114
- --context "$DBCONTEXT" \
115
- --project "$INFRA_PROJECT" \
116
- --startup-project "$STARTUP_PROJECT" \
117
- --force
118
- ```
119
-
120
- > **Note :** Si "Les deux" sélectionné, exécuter pour CoreDbContext puis ExtensionsDbContext.
121
-
122
- ---
123
-
124
- ## STEP 4: Recreate + Apply
125
-
126
- ```bash
127
- dotnet ef database update \
128
- --context "$DBCONTEXT" \
129
- --project "$INFRA_PROJECT" \
130
- --startup-project "$STARTUP_PROJECT" \
131
- --verbose
132
- ```
133
-
134
- ---
135
-
136
- ## STEP 5: Seed (optionnel)
137
-
138
- ```javascript
139
- AskUserQuestion({
140
- questions: [{
141
- question: "Peupler avec données test (HasData)?",
142
- header: "Seed",
143
- options: [
144
- { label: "Oui (recommandé)", description: "Appliquer HasData" },
145
- { label: "Non", description: "Base vide" }
146
- ],
147
- multiSelect: false
148
- }]
149
- })
150
- ```
151
-
152
- ---
153
-
154
- ## Résumé
155
-
156
- ```
157
- RESET - {DATABASE_NAME}
158
- ├── Environnement: {SELECTED_ENV}
159
- ├── Backup: {BACKUP_PATH|none}
160
- ├── Opérations: ✓ Drop, ✓ Create, ✓ {N} migrations
161
- ├── Conformité: ✓ EF Core CLI uniquement
162
- └── Prochains: /efcore:db-status, /efcore:db-seed
163
- ```
164
-
165
- ---
166
-
167
- ## Options
168
-
169
- | Option | Description |
170
- |--------|-------------|
171
- | `--env {name}` | Utiliser appsettings.{name}.json |
172
-
173
- ## Protections
174
-
175
- | Protection | Description |
176
- |------------|-------------|
177
- | Env Display | Affiche base AVANT confirmation |
178
- | Confirmation | Demande explicite avec NOM |
179
- | Production Block | Bloque si Production détecté |
180
- | EF Core Only | Pas de SQL brut |
@@ -1,103 +0,0 @@
1
- ---
2
- description: Populate database with test or initial data
3
- agent: efcore-db-seed
4
- model: haiku
5
- ---
6
-
7
- # EF Core Database Seed
8
-
9
- > **Ref:** [_shared.md](_shared.md)
10
-
11
- ---
12
-
13
- ## Conformité
14
-
15
- | ❌ INTERDIT | ✅ OBLIGATOIRE |
16
- |-------------|----------------|
17
- | Scripts .sql dans repo | `HasData()` dans configurations |
18
- | `sqlcmd` avec INSERT | Classes `IDataSeeder` |
19
- | `migrationBuilder.Sql()` INSERT | Migrations EF Core typées |
20
-
21
- ---
22
-
23
- ## STEP 0: Vérification Environnement
24
-
25
- ```bash
26
- detect_environment
27
- block_production
28
- ```
29
-
30
- ---
31
-
32
- ## STEP 1: Détecter Méthodes Disponibles
33
-
34
- ```bash
35
- # HasData() dans configurations (RECOMMANDÉ)
36
- grep -rq "\.HasData(" . --include="*.cs" && SEED_METHODS+=" hasdata"
37
-
38
- # Classes IDataSeeder
39
- grep -rq "IDataSeeder\|class.*Seeder" . --include="*.cs" && SEED_METHODS+=" seeder-class"
40
-
41
- # Argument --seed dans Program.cs
42
- grep -q "\-\-seed" ./Program.cs && SEED_METHODS+=" cli-argument"
43
-
44
- # WARNING si scripts SQL détectés
45
- [ -f "./scripts/seed.sql" ] && echo "⚠️ Scripts SQL détectés - INTERDIT"
46
- ```
47
-
48
- ---
49
-
50
- ## STEP 2: Sélection Méthode
51
-
52
- ```javascript
53
- AskUserQuestion({
54
- questions: [{
55
- question: "Méthode de seeding?",
56
- header: "Seed",
57
- options: [
58
- { label: "HasData (Recommandé)", description: "Via migrations EF Core" },
59
- { label: "Seeder Class", description: "Exécuter DbSeeder/DataSeeder" },
60
- { label: "CLI --seed", description: "Lancer app avec --seed" }
61
- ],
62
- multiSelect: false
63
- }]
64
- })
65
- ```
66
-
67
- **Si aucune méthode:** afficher guide HasData() et IDataSeeder.
68
-
69
- ---
70
-
71
- ## STEP 3: Exécution
72
-
73
- **HasData:** `dotnet ef database update`
74
-
75
- **Seeder Class:** `dotnet run --project "$STARTUP_PROJECT" -- --seed`
76
-
77
- ---
78
-
79
- ## Résumé
80
-
81
- ```
82
- SEED - {DATABASE_NAME}
83
- ├── Environnement: {SELECTED_ENV}
84
- ├── Méthode: {method_used}
85
- ├── Conformité: ✓ EF Core natif, ✓ Pas de SQL brut
86
- └── Prochains: /efcore:db-status, dotnet run
87
- ```
88
-
89
- ---
90
-
91
- ## Guide Migration SQL → HasData
92
-
93
- ```csharp
94
- // ❌ AVANT (INTERDIT): scripts/seed.sql
95
- INSERT INTO Users (Id, Name) VALUES (1, 'Admin');
96
-
97
- // ✅ APRÈS (CORRECT): UserConfiguration.cs
98
- builder.HasData(new User {
99
- Id = Guid.Parse("7f3c9a2e-8d1b-4e5f-a6c8-9b4d2f7e1a3c"),
100
- Name = "Admin"
101
- });
102
- // Puis: dotnet ef migrations add SeedData
103
- ```
@@ -1,102 +0,0 @@
1
- ---
2
- description: Display migrations and database status
3
- agent: efcore-db-status
4
- model: haiku
5
- ---
6
-
7
- # EF Core Database Status
8
-
9
- > **Ref:** [_shared.md](_shared.md)
10
- > **MCP:** `mcp__smartstack__check_migrations`
11
- > **Type:** Read-only, aucune modification
12
-
13
- ---
14
-
15
- ## STEP 1: Détecter Configuration et DbContext
16
-
17
- ```bash
18
- detect_efcore_project # Appelle detect_dbcontext() automatiquement
19
- detect_environment
20
-
21
- echo "DbContext: $DBCONTEXT ($DBCONTEXT_TYPE)"
22
- echo "Schema: $SCHEMA"
23
- ```
24
-
25
- **Si DbContext non détecté :** Afficher le status des DEUX contextes.
26
-
27
- ---
28
-
29
- ## STEP 2: Invoquer MCP
30
-
31
- ```json
32
- {
33
- "tool": "mcp__smartstack__check_migrations",
34
- "parameters": {
35
- "branch": "<current_branch>",
36
- "projectPath": "<auto-detect>"
37
- }
38
- }
39
- ```
40
-
41
- Extraire: `migrations[]`, `conflicts[]`
42
-
43
- ---
44
-
45
- ## STEP 3: Tester Connexion
46
-
47
- ```bash
48
- CONNECTION_OK=$(dotnet ef database list \
49
- --context "$DBCONTEXT" \
50
- --project "$INFRA_PROJECT" \
51
- --startup-project "$STARTUP_PROJECT" 2>&1)
52
- ```
53
-
54
- ---
55
-
56
- ## STEP 4: Compter Migrations
57
-
58
- ```bash
59
- APPLIED=$(dotnet ef migrations list \
60
- --context "$DBCONTEXT" \
61
- --project "$INFRA_PROJECT" \
62
- --startup-project "$STARTUP_PROJECT" | grep -v "(Pending)" | wc -l)
63
-
64
- PENDING=$(dotnet ef migrations list \
65
- --context "$DBCONTEXT" \
66
- --project "$INFRA_PROJECT" \
67
- --startup-project "$STARTUP_PROJECT" | grep "(Pending)" | wc -l)
68
- ```
69
-
70
- ---
71
-
72
- ## Résumé
73
-
74
- ```
75
- STATUS EF CORE
76
- ├── Projet: {PROJECT_NAME}
77
- ├── Config: {CONFIG_USED}
78
- ├── Connexion: {✓ OK / ✗ Erreur}
79
- ├── Base: {DATABASE_NAME}
80
- ├── Migrations: {TOTAL} (appliquées: {APPLIED}, en attente: {PENDING})
81
- ├── Conformité nommage: {✓ Conforme / ⚠ Avertissements}
82
- └── Règle 1 migration/feature: {✓ OK / ⚠ {N} migrations sur cette branche}
83
- ```
84
-
85
- **Si erreur connexion:**
86
- ```
87
- TROUBLESHOOTING
88
- ├── SQL Server démarré?
89
- ├── appsettings.Local.json configuré?
90
- ├── Base de données existe?
91
- └── Commandes: /efcore:db-reset, /gitflow:10-start
92
- ```
93
-
94
- ---
95
-
96
- ## Options
97
-
98
- | Option | Description |
99
- |--------|-------------|
100
- | `--verbose` | Afficher toutes migrations |
101
- | `--json` | Output JSON |
102
- | `--context {name}` | Spécifier DbContext |
@@ -1,186 +0,0 @@
1
- ---
2
- description: Create or recreate the EF Core migration for the current branch (1 migration per feature)
3
- agent: efcore-migration
4
- model: sonnet
5
- ---
6
-
7
- # EF Core Migration
8
-
9
- > **Ref:** [_shared.md](_shared.md)
10
- > **Règle:** 1 migration par feature. Si existe déjà, supprimer et recréer.
11
-
12
- ---
13
-
14
- ## STEP 0: Validation Cross-Branch
15
-
16
- ```bash
17
- if [ "$CROSS_BRANCH_ENABLED" = "true" ]; then
18
- # Comparer ModelSnapshot avec develop
19
- DIFF_LINES=$(diff "$LOCAL_SNAPSHOT" "$DEVELOP_SNAPSHOT" 2>/dev/null | wc -l)
20
- if [ "$DIFF_LINES" -gt 100 ]; then
21
- echo "⚠️ CONFLIT CROSS-BRANCH DÉTECTÉ ($DIFF_LINES lignes)"
22
- echo "→ /efcore:rebase-snapshot (recommandé)"
23
- [ "$BLOCK_ON_CONFLICT" = "true" ] && exit 1
24
- fi
25
- fi
26
- ```
27
-
28
- Options: `--force`, `--no-cross-check`, `--rebase-first`
29
-
30
- ---
31
-
32
- ## STEP 1: Contexte Git et DbContext
33
-
34
- ```bash
35
- CURRENT_BRANCH=$(git branch --show-current)
36
- # Extraire type (feature/hotfix/release) et nom
37
- detect_efcore_project # Appelle detect_dbcontext() automatiquement
38
-
39
- echo "DbContext: $DBCONTEXT ($DBCONTEXT_TYPE)"
40
- echo "Schema: $SCHEMA"
41
- ```
42
-
43
- **Si DbContext non détecté automatiquement :**
44
-
45
- ```javascript
46
- AskUserQuestion({
47
- questions: [{
48
- question: "Quel DbContext utiliser pour cette migration ?",
49
- header: "DbContext",
50
- options: [
51
- { label: "CoreDbContext", description: "Entités SmartStack (User, Role, Navigation...)" },
52
- { label: "ExtensionsDbContext", description: "Entités client spécifiques" }
53
- ],
54
- multiSelect: false
55
- }]
56
- })
57
- ```
58
-
59
- ---
60
-
61
- ## STEP 2: Recherche Migration Existante
62
-
63
- ```bash
64
- SEARCH_PATTERN="${BRANCH_TYPE}_.*_${BRANCH_NAME}"
65
- EXISTING_MIGRATIONS=$(find "$MIGRATIONS_DIR" -name "*.cs" | grep -E "$SEARCH_PATTERN")
66
- ```
67
-
68
- ---
69
-
70
- ## STEP 3: Décision
71
-
72
- ```javascript
73
- // Si migration existe
74
- AskUserQuestion({
75
- questions: [{
76
- question: "Migration existante. Que faire?",
77
- header: "Migration",
78
- options: [
79
- { label: "Recréer", description: "Supprimer et recréer (Recommandé)" },
80
- { label: "Garder", description: "Conserver, ajouter nouvelle (Non recommandé)" },
81
- { label: "Annuler", description: "Ne rien faire" }
82
- ],
83
- multiSelect: false
84
- }]
85
- })
86
- ```
87
-
88
- ---
89
-
90
- ## STEP 4: Nom Migration (via MCP)
91
-
92
- **OBLIGATOIRE : Utiliser le MCP pour le nommage conforme**
93
-
94
- Pattern: `{context}_v{version}_{sequence}_{Description}`
95
-
96
- **4.1 Demander la description à l'utilisateur :**
97
-
98
- ```javascript
99
- AskUserQuestion({
100
- questions: [{
101
- question: "Description courte de la migration (ex: Add User Roles)",
102
- header: "Description",
103
- options: [
104
- { label: "Add...", description: "Ajout tables/colonnes" },
105
- { label: "Update...", description: "Modification structure" },
106
- { label: "Fix...", description: "Correction schéma" },
107
- { label: "Remove...", description: "Suppression éléments" }
108
- ],
109
- multiSelect: false
110
- }]
111
- })
112
- // L'utilisateur peut aussi saisir un texte libre
113
- ```
114
-
115
- **4.2 Appeler le MCP pour obtenir le nom conforme :**
116
-
117
- ```javascript
118
- // $DESCRIPTION = réponse de l'utilisateur (ex: "Add User Roles")
119
- // $DBCONTEXT_TYPE = "core" ou "extensions" (de detect_dbcontext)
120
-
121
- mcp__smartstack__suggest_migration({
122
- description: DESCRIPTION,
123
- context: DBCONTEXT_TYPE
124
- })
125
-
126
- // Résultat: core_v1.8.0_001_AddUserRoles
127
- ```
128
-
129
- > **INTERDIT :** Calculer le nom manuellement. Toujours déléguer au MCP.
130
-
131
- ---
132
-
133
- ## STEP 5: Création
134
-
135
- ```bash
136
- # $MIGRATION_NAME = résultat du MCP
137
- # $DBCONTEXT = CoreDbContext ou ExtensionsDbContext (de detect_dbcontext)
138
-
139
- dotnet ef migrations add "$MIGRATION_NAME" \
140
- --context "$DBCONTEXT" \
141
- --project "$INFRA_PROJECT" \
142
- --startup-project "$STARTUP_PROJECT" \
143
- -o Persistence/Migrations \
144
- --verbose
145
- ```
146
-
147
- ---
148
-
149
- ## STEP 6: Validation
150
-
151
- ```javascript
152
- AskUserQuestion({
153
- questions: [{
154
- question: "Migration correcte?",
155
- header: "Validation",
156
- options: [
157
- { label: "Oui, appliquer", description: "Deploy sur DB locale" },
158
- { label: "Oui, pas maintenant", description: "Garder sans appliquer" },
159
- { label: "Non, supprimer", description: "Annuler et recommencer" }
160
- ],
161
- multiSelect: false
162
- }]
163
- })
164
- ```
165
-
166
- ---
167
-
168
- ## Résumé
169
-
170
- ```
171
- MIGRATION - {MIGRATION_NAME}
172
- ├── Branche: {CURRENT_BRANCH}
173
- ├── Fichiers: {timestamp}_{NAME}.cs, Designer.cs, Snapshot.cs
174
- ├── Validations: ✓ 1 migration/feature, ✓ Convention nommage
175
- └── Prochains: /efcore:db-deploy, /gitflow:3-commit
176
- ```
177
-
178
- ---
179
-
180
- ## Options
181
-
182
- | Option | Description |
183
- |--------|-------------|
184
- | `--name {name}` | Forcer un nom spécifique |
185
- | `--force` | Supprimer sans confirmation |
186
- | `--no-cross-check` | Désactiver validation cross-branch |