@atlashub/smartstack-cli 1.16.0 → 1.18.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 (41) hide show
  1. package/dist/index.js +74897 -1477
  2. package/dist/index.js.map +1 -1
  3. package/package.json +5 -1
  4. package/templates/agents/efcore/db-deploy.md +5 -0
  5. package/templates/agents/efcore/db-reset.md +5 -0
  6. package/templates/agents/efcore/db-seed.md +5 -0
  7. package/templates/agents/efcore/db-status.md +5 -0
  8. package/templates/agents/efcore/migration.md +8 -0
  9. package/templates/agents/efcore/rebase-snapshot.md +41 -12
  10. package/templates/agents/efcore/squash.md +59 -19
  11. package/templates/commands/efcore/_shared.md +117 -0
  12. package/templates/commands/efcore/db-deploy.md +32 -4
  13. package/templates/commands/efcore/db-reset.md +38 -2
  14. package/templates/commands/efcore/db-status.md +24 -6
  15. package/templates/commands/efcore/migration.md +57 -9
  16. package/templates/commands/efcore/rebase-snapshot.md +56 -3
  17. package/templates/commands/efcore/squash.md +85 -18
  18. package/templates/skills/efcore/SKILL.md +162 -0
  19. package/templates/skills/efcore/steps/db/step-deploy.md +208 -0
  20. package/templates/skills/efcore/steps/db/step-reset.md +259 -0
  21. package/templates/skills/efcore/steps/db/step-seed.md +244 -0
  22. package/templates/skills/efcore/steps/db/step-status.md +198 -0
  23. package/templates/skills/efcore/steps/migration/step-00-init.md +102 -0
  24. package/templates/skills/efcore/steps/migration/step-01-check.md +138 -0
  25. package/templates/skills/efcore/steps/migration/step-02-create.md +144 -0
  26. package/templates/skills/efcore/steps/migration/step-03-validate.md +203 -0
  27. package/templates/skills/efcore/steps/rebase-snapshot/step-00-init.md +173 -0
  28. package/templates/skills/efcore/steps/rebase-snapshot/step-01-backup.md +100 -0
  29. package/templates/skills/efcore/steps/rebase-snapshot/step-02-fetch.md +115 -0
  30. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +108 -0
  31. package/templates/skills/efcore/steps/rebase-snapshot/step-04-validate.md +157 -0
  32. package/templates/skills/efcore/steps/shared/step-00-init.md +266 -0
  33. package/templates/skills/efcore/steps/squash/step-00-init.md +141 -0
  34. package/templates/skills/efcore/steps/squash/step-01-backup.md +120 -0
  35. package/templates/skills/efcore/steps/squash/step-02-fetch.md +168 -0
  36. package/templates/skills/efcore/steps/squash/step-03-create.md +178 -0
  37. package/templates/skills/efcore/steps/squash/step-04-validate.md +174 -0
  38. package/templates/skills/gitflow/steps/step-commit.md +25 -20
  39. package/templates/skills/gitflow/steps/step-start.md +9 -0
  40. package/templates/skills/review-code/SKILL.md +77 -0
  41. package/templates/skills/review-code/references/smartstack-conventions.md +302 -0
@@ -0,0 +1,168 @@
1
+ ---
2
+ name: step-02-fetch
3
+ description: Fetch ModelSnapshot AND migrations from parent branch (CRITICAL)
4
+ next_step: step-03-create.md
5
+ ---
6
+
7
+ # Step 2: Fetch Parent State (CRITICAL)
8
+
9
+ ## YOUR TASK:
10
+
11
+ Recover BOTH the ModelSnapshot AND all migrations from the parent branch.
12
+
13
+ **THIS IS THE MOST CRITICAL STEP.** Recovering only the snapshot loses parent migrations!
14
+
15
+ **Previous step:** `step-01-backup.md`
16
+
17
+ ---
18
+
19
+ ## PRINCIPLE:
20
+
21
+ ```
22
+ GOLDEN RULE: Fetch SNAPSHOT + MIGRATIONS from PARENT branch
23
+
24
+ feature/* → snapshot + migrations from develop
25
+ develop → snapshot + migrations from main
26
+ release/* → snapshot + migrations from main
27
+ hotfix/* → snapshot + migrations from main
28
+
29
+ NEVER fetch only the snapshot without migrations!
30
+ ```
31
+
32
+ ---
33
+
34
+ ## EXECUTION SEQUENCE:
35
+
36
+ ### 1. Fetch Parent Branch
37
+
38
+ ```bash
39
+ echo "Fetching origin/$BASE_BRANCH..."
40
+ git fetch origin "$BASE_BRANCH" --quiet
41
+ ```
42
+
43
+ ### 2. Recover ModelSnapshot
44
+
45
+ ```bash
46
+ echo ""
47
+ echo "Recovering ModelSnapshot from origin/$BASE_BRANCH..."
48
+
49
+ SNAPSHOT_FILE=$(git ls-tree -r --name-only "origin/$BASE_BRANCH" -- "$MIGRATIONS_DIR" | grep "ModelSnapshot.cs$" | head -1)
50
+
51
+ if [ -n "$SNAPSHOT_FILE" ]; then
52
+ git checkout "origin/$BASE_BRANCH" -- "$SNAPSHOT_FILE"
53
+ echo " Snapshot: $(basename "$SNAPSHOT_FILE")"
54
+ else
55
+ echo " WARNING: No snapshot found on origin/$BASE_BRANCH"
56
+ fi
57
+ ```
58
+
59
+ ### 3. Recover ALL Parent Migrations (CRUCIAL!)
60
+
61
+ ```bash
62
+ echo ""
63
+ echo "Recovering migrations from origin/$BASE_BRANCH..."
64
+
65
+ RECOVERED_COUNT=0
66
+
67
+ for base_mig in $BASE_MIGRATIONS; do
68
+ base_name=$(basename "${base_mig%.cs}")
69
+
70
+ # Recover migration file
71
+ git checkout "origin/$BASE_BRANCH" -- "$MIGRATIONS_DIR/${base_name}.cs" 2>/dev/null && {
72
+ echo " ${base_name}.cs"
73
+ RECOVERED_COUNT=$((RECOVERED_COUNT + 1))
74
+ }
75
+
76
+ # Recover Designer file
77
+ git checkout "origin/$BASE_BRANCH" -- "$MIGRATIONS_DIR/${base_name}.Designer.cs" 2>/dev/null && {
78
+ echo " ${base_name}.Designer.cs"
79
+ }
80
+ done
81
+
82
+ echo ""
83
+ echo "Recovered: $RECOVERED_COUNT migrations from origin/$BASE_BRANCH"
84
+ ```
85
+
86
+ ### 4. Delete Branch-Only Migrations
87
+
88
+ ```bash
89
+ echo ""
90
+ echo "Removing branch-specific migrations..."
91
+
92
+ for mig in "${BRANCH_ONLY_MIGRATIONS[@]}"; do
93
+ mig_name="${mig%.cs}"
94
+
95
+ rm -f "$MIGRATIONS_DIR/${mig_name}.cs"
96
+ rm -f "$MIGRATIONS_DIR/${mig_name}.Designer.cs"
97
+
98
+ echo " Removed: $mig_name"
99
+ done
100
+
101
+ echo ""
102
+ echo "Removed: ${#BRANCH_ONLY_MIGRATIONS[@]} branch-specific migrations"
103
+ ```
104
+
105
+ ### 5. Verify State
106
+
107
+ ```bash
108
+ echo ""
109
+ echo "Current state after fetch:"
110
+ echo ""
111
+
112
+ ls -la "$MIGRATIONS_DIR"/*.cs 2>/dev/null | while read line; do
113
+ echo " $line"
114
+ done
115
+
116
+ CURRENT_MIGS=$(find "$MIGRATIONS_DIR" -name "*.cs" 2>/dev/null | grep -v "Designer\|Snapshot" | wc -l)
117
+ echo ""
118
+ echo "Migrations remaining: $CURRENT_MIGS (all from $BASE_BRANCH)"
119
+ ```
120
+
121
+ ---
122
+
123
+ ## EXPECTED RESULT:
124
+
125
+ ```
126
+ After step-02-fetch:
127
+ ├── {base_migration_1}.cs ← From parent (preserved)
128
+ ├── {base_migration_1}.Designer.cs
129
+ ├── {base_migration_N}.cs ← From parent (preserved)
130
+ ├── {base_migration_N}.Designer.cs
131
+ └── {DbContext}ModelSnapshot.cs ← From parent (recovered)
132
+
133
+ Branch-specific migrations: DELETED (will be recreated consolidated)
134
+ ```
135
+
136
+ ---
137
+
138
+ ## STATE OUTPUT:
139
+
140
+ | Variable | Description |
141
+ |----------|-------------|
142
+ | `{recovered_count}` | Number of parent migrations recovered |
143
+ | `{snapshot_recovered}` | true if snapshot was recovered |
144
+
145
+ ---
146
+
147
+ ## FAILURE HANDLING:
148
+
149
+ If this step fails:
150
+
151
+ ```bash
152
+ # Restore from backup
153
+ cp "{BACKUP_DIR}"/*.cs "{MIGRATIONS_DIR}/"
154
+ echo "Restored from backup"
155
+ ```
156
+
157
+ ---
158
+
159
+ ## SUCCESS CRITERIA:
160
+
161
+ - ModelSnapshot recovered from parent
162
+ - ALL parent migrations recovered
163
+ - Branch-specific migrations removed
164
+ - No migration loss from parent
165
+
166
+ ## NEXT STEP:
167
+
168
+ → `step-03-create.md`
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: step-03-create
3
+ description: Create consolidated migration using MCP for naming
4
+ next_step: step-04-validate.md
5
+ ---
6
+
7
+ # Step 3: Create Consolidated Migration
8
+
9
+ ## YOUR TASK:
10
+
11
+ Create a single consolidated migration that captures all changes from the branch.
12
+
13
+ **MANDATORY:** Use MCP `suggest_migration` for compliant naming. NEVER hardcode names.
14
+
15
+ **Previous step:** `step-02-fetch.md`
16
+
17
+ ---
18
+
19
+ ## EXECUTION SEQUENCE:
20
+
21
+ ### 1. Build Description from Branch Context
22
+
23
+ ```bash
24
+ case "$BRANCH_TYPE" in
25
+ feature)
26
+ # Extract feature name: feature/user-auth → UserAuth
27
+ FEATURE_NAME=$(echo "$CURRENT_BRANCH" | sed 's|feature/||' | sed 's/-/ /g' | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2))}1' | tr -d ' ')
28
+ DESCRIPTION="${FEATURE_NAME}Consolidated"
29
+ ;;
30
+ release)
31
+ VERSION=$(echo "$CURRENT_BRANCH" | sed 's|release/v\?||')
32
+ DESCRIPTION="Release${VERSION}Initial"
33
+ ;;
34
+ hotfix)
35
+ VERSION=$(echo "$CURRENT_BRANCH" | sed 's|hotfix/v\?||')
36
+ DESCRIPTION="Hotfix${VERSION}Fix"
37
+ ;;
38
+ develop)
39
+ DESCRIPTION="DevelopConsolidated"
40
+ ;;
41
+ *)
42
+ DESCRIPTION="Consolidated"
43
+ ;;
44
+ esac
45
+
46
+ echo "Description: $DESCRIPTION"
47
+ echo "DbContext Type: $DBCONTEXT_TYPE"
48
+ ```
49
+
50
+ ### 2. Get Migration Name from MCP (MANDATORY)
51
+
52
+ ```javascript
53
+ // DBCONTEXT_TYPE = "core" or "extensions" (from detect_dbcontext)
54
+ // DESCRIPTION = built above (e.g., "MultitenantConsolidated")
55
+
56
+ const result = await mcp__smartstack__suggest_migration({
57
+ description: DESCRIPTION,
58
+ context: DBCONTEXT_TYPE // NEVER hardcode!
59
+ });
60
+
61
+ // Result example: core_v1.9.0_001_MultitenantConsolidated
62
+ MIGRATION_NAME = result.migrationName;
63
+ ```
64
+
65
+ **FORBIDDEN:**
66
+ - Calculating name manually
67
+ - Hardcoding context as "core"
68
+ - Using underscores instead of dots in version
69
+
70
+ ### 3. Create Migration with EF Core
71
+
72
+ ```bash
73
+ # MIGRATION_NAME = result from MCP (e.g., core_v1.9.0_001_MultitenantConsolidated)
74
+ # DBCONTEXT = CoreDbContext or ExtensionsDbContext (from detect_dbcontext)
75
+
76
+ echo ""
77
+ echo "Creating migration: $MIGRATION_NAME"
78
+ echo "Context: $DBCONTEXT"
79
+ echo ""
80
+
81
+ dotnet ef migrations add "$MIGRATION_NAME" \
82
+ --context "$DBCONTEXT" \
83
+ --project "$INFRA_PROJECT" \
84
+ --startup-project "$STARTUP_PROJECT" \
85
+ -o Persistence/Migrations \
86
+ --verbose
87
+ ```
88
+
89
+ ### 4. Verify Migration Created
90
+
91
+ ```bash
92
+ # Check migration files exist
93
+ MIGRATION_FILE="$MIGRATIONS_DIR/${MIGRATION_NAME}.cs"
94
+ DESIGNER_FILE="$MIGRATIONS_DIR/${MIGRATION_NAME}.Designer.cs"
95
+
96
+ if [ ! -f "$MIGRATION_FILE" ]; then
97
+ echo "ERROR: Migration file not created"
98
+ echo "Expected: $MIGRATION_FILE"
99
+
100
+ # Restore from backup
101
+ cp "$BACKUP_DIR"/*.cs "$MIGRATIONS_DIR/"
102
+ echo "Restored from backup"
103
+ exit 1
104
+ fi
105
+
106
+ if [ ! -f "$DESIGNER_FILE" ]; then
107
+ echo "ERROR: Designer file not created"
108
+ exit 1
109
+ fi
110
+
111
+ echo ""
112
+ echo "Migration created:"
113
+ echo " $MIGRATION_FILE"
114
+ echo " $DESIGNER_FILE"
115
+ ```
116
+
117
+ ### 5. Check Migration Content
118
+
119
+ ```bash
120
+ # Verify migration has content (not empty)
121
+ UP_METHODS=$(grep -c "protected override void Up" "$MIGRATION_FILE" || echo "0")
122
+ DOWN_METHODS=$(grep -c "protected override void Down" "$MIGRATION_FILE" || echo "0")
123
+
124
+ if [ "$UP_METHODS" -eq 0 ]; then
125
+ echo "WARNING: Migration may be empty (no Up method found)"
126
+ fi
127
+
128
+ echo ""
129
+ echo "Migration content:"
130
+ echo " Up methods: $UP_METHODS"
131
+ echo " Down methods: $DOWN_METHODS"
132
+ ```
133
+
134
+ ---
135
+
136
+ ## EXPECTED RESULT:
137
+
138
+ ```
139
+ After step-03-create:
140
+ ├── {base_migration_1}.cs ← From parent (preserved)
141
+ ├── {base_migration_1}.Designer.cs
142
+ ├── {NEW_MIGRATION_NAME}.cs ← NEW: Consolidated migration
143
+ ├── {NEW_MIGRATION_NAME}.Designer.cs ← NEW: Designer file
144
+ └── {DbContext}ModelSnapshot.cs ← Updated with new migration
145
+ ```
146
+
147
+ ---
148
+
149
+ ## STATE OUTPUT:
150
+
151
+ | Variable | Description |
152
+ |----------|-------------|
153
+ | `{migration_name}` | Name from MCP (e.g., core_v1.9.0_001_...) |
154
+ | `{migration_file}` | Full path to .cs file |
155
+ | `{designer_file}` | Full path to .Designer.cs file |
156
+
157
+ ---
158
+
159
+ ## ERROR HANDLING:
160
+
161
+ | Error | Resolution |
162
+ |-------|------------|
163
+ | MCP fails | Check MCP connectivity, retry |
164
+ | Migration creation fails | Restore from backup, check errors |
165
+ | Empty migration | Warning only, may be valid |
166
+
167
+ ---
168
+
169
+ ## SUCCESS CRITERIA:
170
+
171
+ - MCP called for migration name
172
+ - Migration file created
173
+ - Designer file created
174
+ - Snapshot updated
175
+
176
+ ## NEXT STEP:
177
+
178
+ → `step-04-validate.md`
@@ -0,0 +1,174 @@
1
+ ---
2
+ name: step-04-validate
3
+ description: Validate squash - build and generate script
4
+ next_step: null
5
+ ---
6
+
7
+ # Step 4: Validate
8
+
9
+ ## YOUR TASK:
10
+
11
+ Validate the squash by building the project and generating an idempotent script.
12
+
13
+ **Previous step:** `step-03-create.md`
14
+
15
+ ---
16
+
17
+ ## EXECUTION SEQUENCE:
18
+
19
+ ### 1. Build Project
20
+
21
+ ```bash
22
+ echo "Building project..."
23
+ echo ""
24
+
25
+ dotnet build "$INFRA_PROJECT" --no-restore
26
+
27
+ if [ $? -ne 0 ]; then
28
+ echo ""
29
+ echo "ERROR: Build FAILED"
30
+ echo ""
31
+ echo "Restoring from backup..."
32
+ cp "$BACKUP_DIR"/*.cs "$MIGRATIONS_DIR/"
33
+ echo "Restored. Please fix issues and retry."
34
+ exit 1
35
+ fi
36
+
37
+ echo ""
38
+ echo "Build: OK"
39
+ ```
40
+
41
+ ### 2. List Migrations
42
+
43
+ ```bash
44
+ echo ""
45
+ echo "Migration list:"
46
+ echo ""
47
+
48
+ dotnet ef migrations list \
49
+ --context "$DBCONTEXT" \
50
+ --project "$INFRA_PROJECT" \
51
+ --startup-project "$STARTUP_PROJECT" \
52
+ --no-build
53
+ ```
54
+
55
+ ### 3. Generate Idempotent Script (Validation)
56
+
57
+ ```bash
58
+ echo ""
59
+ echo "Generating idempotent script..."
60
+ echo ""
61
+
62
+ SCRIPT_FILE="$BACKUP_DIR/migration_script.sql"
63
+
64
+ dotnet ef migrations script \
65
+ --context "$DBCONTEXT" \
66
+ --project "$INFRA_PROJECT" \
67
+ --startup-project "$STARTUP_PROJECT" \
68
+ --idempotent \
69
+ --no-build \
70
+ -o "$SCRIPT_FILE"
71
+
72
+ if [ $? -ne 0 ]; then
73
+ echo ""
74
+ echo "ERROR: Script generation FAILED"
75
+ echo ""
76
+ echo "This indicates a migration problem."
77
+ echo "Restoring from backup..."
78
+ cp "$BACKUP_DIR"/*.cs "$MIGRATIONS_DIR/"
79
+ exit 1
80
+ fi
81
+
82
+ echo "Script generated: $SCRIPT_FILE"
83
+ ```
84
+
85
+ ### 4. Final Summary
86
+
87
+ ```bash
88
+ # Count final migrations
89
+ FINAL_MIGRATION_COUNT=$(find "$MIGRATIONS_DIR" -name "*.cs" 2>/dev/null | grep -v "Designer\|Snapshot" | wc -l)
90
+
91
+ echo ""
92
+ echo "==========================================="
93
+ echo "SQUASH COMPLETE"
94
+ echo "==========================================="
95
+ echo ""
96
+ echo "Branch: $CURRENT_BRANCH"
97
+ echo "Parent: $BASE_BRANCH"
98
+ echo "DbContext: $DBCONTEXT ($DBCONTEXT_TYPE)"
99
+ echo ""
100
+ echo "Recovered from $BASE_BRANCH:"
101
+ echo " - ModelSnapshot"
102
+ echo " - $BASE_MIGRATION_COUNT migrations"
103
+ echo ""
104
+ echo "Consolidated:"
105
+ echo " - Before: $MIGRATION_COUNT migrations (branch-specific)"
106
+ echo " - After: 1 migration ($MIGRATION_NAME)"
107
+ echo ""
108
+ echo "Total: $FINAL_MIGRATION_COUNT migrations"
109
+ echo ""
110
+ echo "Backup: $BACKUP_DIR"
111
+ echo "Script: $SCRIPT_FILE"
112
+ echo ""
113
+ echo "==========================================="
114
+ echo ""
115
+ echo "Next steps:"
116
+ echo " /efcore db-reset # Reset local database"
117
+ echo " /efcore db-deploy # Apply migrations"
118
+ echo " /gitflow commit # Commit changes"
119
+ echo ""
120
+ ```
121
+
122
+ ---
123
+
124
+ ## OUTPUT FORMAT:
125
+
126
+ ```
127
+ SQUASH COMPLETE
128
+ ===============
129
+ Branch: {current_branch}
130
+ Parent: {base_branch}
131
+ DbContext: {dbcontext} ({dbcontext_type})
132
+
133
+ Recovered from {base_branch}:
134
+ - ModelSnapshot
135
+ - {base_migration_count} migrations
136
+
137
+ Consolidated:
138
+ - Before: {migration_count} migrations (branch-specific)
139
+ - After: 1 migration ({migration_name})
140
+
141
+ Total: {final_migration_count} migrations
142
+
143
+ Backup: {backup_dir}
144
+ Script: {backup_dir}/migration_script.sql
145
+
146
+ Next: /efcore db-reset, /efcore db-deploy, /gitflow commit
147
+ ```
148
+
149
+ ---
150
+
151
+ ## ERROR HANDLING:
152
+
153
+ | Error | Action |
154
+ |-------|--------|
155
+ | Build fails | Restore backup, show errors |
156
+ | Script fails | Restore backup, investigate |
157
+
158
+ **Restore command:**
159
+ ```bash
160
+ cp "{BACKUP_DIR}"/*.cs "{MIGRATIONS_DIR}/"
161
+ ```
162
+
163
+ ---
164
+
165
+ ## SUCCESS CRITERIA:
166
+
167
+ - Build passes
168
+ - Migration list shows correct migrations
169
+ - Idempotent script generates successfully
170
+ - Summary displayed
171
+
172
+ ## COMPLETION:
173
+
174
+ Squash workflow complete. Database not modified (use `/efcore db-deploy` to apply).
@@ -188,27 +188,32 @@ EOF
188
188
  COMMIT_HASH=$(git rev-parse --short HEAD)
189
189
  ```
190
190
 
191
- ### 7. Auto-Push (based on config)
191
+ ### 7. Push to Remote (ALWAYS ASK USER)
192
+
193
+ **MANDATORY: Always ask user before pushing commits:**
194
+
195
+ ```yaml
196
+ AskUserQuestion:
197
+ header: "Push"
198
+ question: "Push commit to origin/$CURRENT?"
199
+ options:
200
+ - label: "Yes, push now"
201
+ description: "git push origin $CURRENT"
202
+ - label: "No, later"
203
+ description: "Keep commit local for now"
204
+ ```
192
205
 
206
+ **If user chooses "Yes":**
193
207
  ```bash
194
- PUSH_MODE=$(grep -oP '"afterCommit":\s*"\K[^"]+' .claude/gitflow/config.json 2>/dev/null || echo "ask")
195
-
196
- case "$PUSH_MODE" in
197
- always)
198
- git push origin $CURRENT
199
- PUSHED="yes"
200
- ;;
201
- worktree)
202
- # Push if in worktree
203
- [ -n "$(git worktree list | grep $(pwd))" ] && git push origin $CURRENT && PUSHED="yes"
204
- ;;
205
- ask)
206
- # Ask user
207
- ;;
208
- never)
209
- PUSHED="no"
210
- ;;
211
- esac
208
+ git push origin $CURRENT
209
+ PUSHED="yes"
210
+ echo "✅ Pushed to origin/$CURRENT"
211
+ ```
212
+
213
+ **If user chooses "No":**
214
+ ```bash
215
+ PUSHED="no"
216
+ echo "⏸️ Commit kept local. Push later with: git push origin $CURRENT"
212
217
  ```
213
218
 
214
219
  ### 8. Summary
@@ -248,7 +253,7 @@ esac
248
253
  - Migrations validated (if present)
249
254
  - Destructive operations confirmed
250
255
  - Commit created with proper message
251
- - Pushed (if configured)
256
+ - **Push: ALWAYS ask user (never automatic)**
252
257
 
253
258
  ## NEXT STEP:
254
259
 
@@ -152,6 +152,14 @@ git checkout "$BASE_BRANCH" && git pull origin "$BASE_BRANCH"
152
152
  git checkout -b "$FULL_BRANCH"
153
153
  ```
154
154
 
155
+ ### 6b. Push Branch to Remote (AUTOMATIC)
156
+
157
+ **ALWAYS push immediately after branch creation:**
158
+ ```bash
159
+ git push -u origin "$FULL_BRANCH"
160
+ echo "✅ Branch pushed to origin/$FULL_BRANCH"
161
+ ```
162
+
155
163
  ### 7. Create Local Environment Config (Backend + Frontend)
156
164
 
157
165
  **Detect project structure:**
@@ -323,6 +331,7 @@ EOF
323
331
  ## SUCCESS CRITERIA:
324
332
 
325
333
  - Branch created from correct base
334
+ - **Branch pushed to remote (AUTOMATIC)**
326
335
  - Worktree set up (if enabled)
327
336
  - Backend local config created: `appsettings.Local.json` (if .NET API detected)
328
337
  - Frontend local config created: `.env.local` + `npm run local` script (if web project detected)
@@ -7,8 +7,83 @@ description: This skill should be used when the user asks to "review code", "rev
7
7
  Provide expert-level code review guidance that focuses on high-impact issues: security vulnerabilities, logic errors, maintainability problems, and architectural concerns. Skip nitpicks and style issues that should be automated.
8
8
 
9
9
  Based on research from Google, Microsoft, OWASP, and academic studies on code review effectiveness.
10
+
11
+ **For SmartStack projects**: Automatically validates SmartStack-specific conventions via MCP.
10
12
  </objective>
11
13
 
14
+ <smartstack_integration>
15
+ ## SmartStack Project Detection & MCP Validation
16
+
17
+ **CRITICAL**: Before starting any code review, detect if this is a SmartStack project and run MCP validation.
18
+
19
+ <detection>
20
+ **Detect SmartStack project by checking for ANY of these:**
21
+ - `.claude/mcp-status.json` exists
22
+ - `SmartStack.Domain/` or `SmartStack.Application/` directories
23
+ - `*.sln` file containing "SmartStack"
24
+ - `package.json` with `@smartstack/` dependencies
25
+ </detection>
26
+
27
+ <mcp_validation>
28
+ **If SmartStack detected, run MCP validation FIRST:**
29
+
30
+ 1. **Validate conventions** (BLOCKING issues):
31
+ ```
32
+ mcp__smartstack__validate_conventions
33
+ checks: ["all"]
34
+ ```
35
+
36
+ 2. **Validate security** (when available):
37
+ ```
38
+ mcp__smartstack__validate_security
39
+ checks: ["all"]
40
+ ```
41
+
42
+ 3. **Analyze code quality** (when available):
43
+ ```
44
+ mcp__smartstack__analyze_code_quality
45
+ metrics: ["all"]
46
+ ```
47
+
48
+ 4. **Validate test conventions**:
49
+ ```
50
+ mcp__smartstack__validate_test_conventions
51
+ checks: ["all"]
52
+ ```
53
+ </mcp_validation>
54
+
55
+ <mcp_checks>
56
+ **SmartStack-specific checks via MCP:**
57
+
58
+ | Category | MCP Tool | What it validates |
59
+ |----------|----------|-------------------|
60
+ | **Tables** | `validate_conventions` | Préfixes (auth_, nav_, cfg_), schemas (core/extensions) |
61
+ | **Migrations** | `validate_conventions` | Nommage `{context}_v{version}_{sequence}_{Description}` |
62
+ | **Services** | `validate_conventions` | Interfaces I*Service |
63
+ | **Entities** | `validate_conventions` | ITenantEntity, factory methods, private constructors |
64
+ | **Controllers** | `validate_conventions` | [NavRoute] attributes, route format |
65
+ | **Multi-tenant** | `validate_conventions` | TenantId isolation, no cross-tenant access |
66
+ | **Tests** | `validate_test_conventions` | Naming, structure, patterns AAA |
67
+ </mcp_checks>
68
+
69
+ <output_integration>
70
+ **Merge MCP results into review output:**
71
+
72
+ ```markdown
73
+ ## SmartStack Conventions (via MCP)
74
+
75
+ | Severity | Issue | Location | Fix |
76
+ |----------|-------|----------|-----|
77
+ | BLOCKING | {MCP error} | `file:line` | {MCP suggestion} |
78
+ | WARNING | {MCP warning} | `file:line` | {MCP suggestion} |
79
+ ```
80
+
81
+ **Priority mapping:**
82
+ - MCP errors → `[BLOCKING]`
83
+ - MCP warnings → `[SUGGESTION]`
84
+ </output_integration>
85
+ </smartstack_integration>
86
+
12
87
  <quick_start>
13
88
  <review_priority>
14
89
  **Priority order**: Security > Correctness > Maintainability > Performance
@@ -207,6 +282,7 @@ A good code review:
207
282
  - Avoids nitpicks on style/formatting
208
283
  - Completes in reasonable time (<4 hours for small PRs)
209
284
  - **[React/Next.js]** Includes Vercel best practices review when applicable
285
+ - **[SmartStack]** Runs MCP validation and integrates results into review output
210
286
  </success_criteria>
211
287
 
212
288
  <reference_guides>
@@ -216,4 +292,5 @@ For detailed guidance and patterns:
216
292
  - **`references/clean-code-principles.md`** - SOLID principles, naming conventions, function design, code smell detection
217
293
  - **`references/feedback-patterns.md`** - Valuable vs wasteful feedback patterns, communication strategies, priority labeling
218
294
  - **`references/code-quality-metrics.md`** - Complexity calculations, maintainability index, measurement techniques
295
+ - **`references/smartstack-conventions.md`** - SmartStack-specific conventions, MCP integration, multi-tenant patterns
219
296
  </reference_guides>