@atlashub/smartstack-cli 1.13.2 → 1.14.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.
- package/.documentation/agents.html +1 -1
- package/.documentation/apex.html +1 -1
- package/.documentation/business-analyse.html +1 -1
- package/.documentation/cli-commands.html +3 -3
- package/.documentation/commands.html +1 -1
- package/.documentation/efcore.html +1 -1
- package/.documentation/gitflow.html +1 -1
- package/.documentation/hooks.html +1 -1
- package/.documentation/index.html +1 -1
- package/.documentation/init.html +3 -3
- package/.documentation/installation.html +1001 -352
- package/.documentation/ralph-loop.html +1 -1
- package/.documentation/test-web.html +1 -1
- package/README.md +88 -20
- package/dist/index.js +276 -85
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/agents/code-reviewer.md +163 -0
- package/templates/agents/efcore/db-deploy.md +25 -7
- package/templates/agents/efcore/db-reset.md +31 -10
- package/templates/agents/efcore/db-status.md +22 -5
- package/templates/agents/efcore/migration.md +69 -19
- package/templates/agents/gitflow/cleanup.md +8 -1
- package/templates/agents/gitflow/commit.md +7 -5
- package/templates/agents/gitflow/finish.md +6 -4
- package/templates/agents/gitflow/pr.md +8 -1
- package/templates/agents/gitflow/start.md +1 -1
- package/templates/commands/check-version.md +267 -0
- package/templates/commands/efcore/_shared.md +30 -1
- package/templates/commands/efcore/db-reset.md +18 -6
- package/templates/commands/gitflow/OPTIMIZATIONS.md +206 -0
- package/templates/commands/refactor.md +164 -0
- package/templates/project/DependencyInjection.Application.cs.template +25 -0
- package/templates/project/DependencyInjection.Infrastructure.cs.template +61 -0
- package/templates/project/DesignTimeExtensionsDbContextFactory.cs.template +70 -0
- package/templates/project/ExampleEntity.cs.template +116 -0
- package/templates/project/ExampleEntityConfiguration.cs.template +64 -0
- package/templates/project/ExampleService.cs.template +146 -0
- package/templates/project/ExtensionsDbContext.cs.template +41 -0
- package/templates/project/IExtensionsDbContext.cs.template +22 -0
- package/templates/project/Program.cs.template +47 -0
- package/templates/project/README.md +79 -0
- package/templates/ralph/README.md +10 -8
- package/templates/ralph/ralph.config.yaml +2 -2
- package/templates/skills/_shared.md +44 -44
- package/templates/skills/ai-prompt/SKILL.md +55 -55
- package/templates/skills/apex/SKILL.md +235 -0
- package/templates/skills/apex/steps/step-00-init.md +203 -0
- package/templates/skills/apex/steps/step-01-analyze.md +210 -0
- package/templates/skills/apex/steps/step-02-plan.md +217 -0
- package/templates/skills/apex/steps/step-03-execute.md +178 -0
- package/templates/skills/apex/steps/step-04-validate.md +217 -0
- package/templates/skills/apex/steps/step-05-examine.md +207 -0
- package/templates/skills/apex/steps/step-06-resolve.md +181 -0
- package/templates/skills/apex/steps/step-07-tests.md +206 -0
- package/templates/skills/apex/steps/step-08-run-tests.md +207 -0
- package/templates/skills/apex/templates/00-context.md +46 -0
- package/templates/skills/apex/templates/01-analyze.md +63 -0
- package/templates/skills/apex/templates/02-plan.md +63 -0
- package/templates/skills/apex/templates/03-execute.md +34 -0
- package/templates/skills/apex/templates/04-validate.md +61 -0
- package/templates/skills/apex/templates/05-examine.md +58 -0
- package/templates/skills/apex/templates/06-resolve.md +39 -0
- package/templates/skills/apex/templates/07-tests.md +56 -0
- package/templates/skills/apex/templates/08-run-tests.md +41 -0
- package/templates/skills/apex/templates/README.md +69 -0
- package/templates/skills/application/SKILL.md +50 -50
- package/templates/skills/application/templates-backend.md +25 -25
- package/templates/skills/application/templates-frontend.md +43 -43
- package/templates/skills/application/templates-i18n.md +29 -29
- package/templates/skills/application/templates-seed.md +77 -77
- package/templates/skills/business-analyse/SKILL.md +223 -0
- package/templates/skills/business-analyse/_shared.md +258 -0
- package/templates/skills/business-analyse/questionnaire/01-context.md +33 -0
- package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +35 -0
- package/templates/skills/business-analyse/questionnaire/03-scope.md +35 -0
- package/templates/skills/business-analyse/questionnaire/04-data.md +36 -0
- package/templates/skills/business-analyse/questionnaire/05-integrations.md +36 -0
- package/templates/skills/business-analyse/questionnaire/06-security.md +40 -0
- package/templates/skills/business-analyse/questionnaire/07-ui.md +36 -0
- package/templates/skills/business-analyse/questionnaire/08-performance.md +35 -0
- package/templates/skills/business-analyse/questionnaire/09-constraints.md +35 -0
- package/templates/skills/business-analyse/questionnaire/10-documentation.md +35 -0
- package/templates/skills/business-analyse/questionnaire.md +177 -177
- package/templates/skills/business-analyse/react/components.md +340 -0
- package/templates/skills/business-analyse/react/i18n-template.md +245 -0
- package/templates/skills/business-analyse/react/schema.md +151 -0
- package/templates/skills/business-analyse/steps/step-00-init.md +293 -0
- package/templates/skills/business-analyse/steps/step-01-discover.md +267 -0
- package/templates/skills/business-analyse/steps/step-02-analyse.md +243 -0
- package/templates/skills/business-analyse/steps/step-03-specify.md +317 -0
- package/templates/skills/business-analyse/steps/step-04-validate.md +239 -0
- package/templates/skills/business-analyse/steps/step-05-handoff.md +336 -0
- package/templates/skills/business-analyse/steps/step-06-doc-html.md +261 -0
- package/templates/skills/business-analyse/templates/00-context.md +105 -0
- package/templates/skills/business-analyse/templates/frd-brd.md +97 -0
- package/templates/skills/business-analyse/templates/frd-discovery.md +78 -0
- package/templates/skills/business-analyse/templates/frd-handoff.md +118 -0
- package/templates/skills/business-analyse/templates/frd-spec.md +168 -0
- package/templates/skills/business-analyse/templates-frd.md +217 -217
- package/templates/skills/business-analyse/templates-react.md +26 -26
- package/templates/skills/controller/SKILL.md +141 -92
- package/templates/skills/controller/postman-templates.md +15 -15
- package/templates/skills/controller/steps/step-00-init.md +191 -0
- package/templates/skills/controller/steps/step-01-analyze.md +146 -0
- package/templates/skills/controller/steps/step-02-plan.md +176 -0
- package/templates/skills/controller/steps/step-03-generate.md +219 -0
- package/templates/skills/controller/steps/step-04-perms.md +219 -0
- package/templates/skills/controller/steps/step-05-validate.md +107 -0
- package/templates/skills/controller/templates.md +77 -77
- package/templates/skills/documentation/SKILL.md +79 -79
- package/templates/skills/feature-full/SKILL.md +38 -38
- package/templates/skills/gitflow/SKILL.md +277 -0
- package/templates/{commands → skills}/gitflow/_shared.md +20 -20
- package/templates/skills/gitflow/phases/abort.md +173 -0
- package/templates/skills/gitflow/phases/cleanup.md +226 -0
- package/templates/skills/gitflow/phases/status.md +178 -0
- package/templates/skills/gitflow/steps/step-commit.md +255 -0
- package/templates/skills/gitflow/steps/step-finish.md +255 -0
- package/templates/skills/gitflow/steps/step-init.md +209 -0
- package/templates/skills/gitflow/steps/step-merge.md +225 -0
- package/templates/skills/gitflow/steps/step-plan.md +208 -0
- package/templates/skills/gitflow/steps/step-pr.md +235 -0
- package/templates/skills/gitflow/steps/step-start.md +234 -0
- package/templates/skills/gitflow/steps/step-sync.md +200 -0
- package/templates/skills/gitflow/templates/config.json +53 -0
- package/templates/skills/notification/SKILL.md +51 -51
- package/templates/skills/ralph-loop/SKILL.md +228 -0
- package/templates/skills/ralph-loop/steps/step-00-init.md +201 -0
- package/templates/skills/ralph-loop/steps/step-01-task.md +169 -0
- package/templates/skills/ralph-loop/steps/step-02-execute.md +173 -0
- package/templates/skills/ralph-loop/steps/step-03-commit.md +170 -0
- package/templates/skills/ralph-loop/steps/step-04-check.md +162 -0
- package/templates/skills/ralph-loop/steps/step-05-report.md +181 -0
- package/templates/skills/review-code/SKILL.md +219 -0
- package/templates/skills/review-code/references/clean-code-principles.md +140 -0
- package/templates/skills/review-code/references/code-quality-metrics.md +174 -0
- package/templates/skills/review-code/references/feedback-patterns.md +149 -0
- package/templates/skills/review-code/references/security-checklist.md +127 -0
- package/templates/skills/ui-components/SKILL.md +54 -54
- package/templates/skills/workflow/SKILL.md +46 -46
- package/templates/commands/ai-prompt.md +0 -315
- package/templates/commands/apex/1-analyze.md +0 -100
- package/templates/commands/apex/2-plan.md +0 -145
- package/templates/commands/apex/3-execute.md +0 -171
- package/templates/commands/apex/4-examine.md +0 -116
- package/templates/commands/apex/5-tasks.md +0 -209
- package/templates/commands/apex.md +0 -76
- package/templates/commands/application/create.md +0 -362
- package/templates/commands/application/templates-backend.md +0 -463
- package/templates/commands/application/templates-frontend.md +0 -517
- package/templates/commands/application/templates-i18n.md +0 -478
- package/templates/commands/application/templates-seed.md +0 -362
- package/templates/commands/application.md +0 -303
- package/templates/commands/business-analyse/0-orchestrate.md +0 -156
- package/templates/commands/business-analyse/1-init.md +0 -99
- package/templates/commands/business-analyse/2-discover.md +0 -143
- package/templates/commands/business-analyse/3-analyse.md +0 -106
- package/templates/commands/business-analyse/4-specify.md +0 -133
- package/templates/commands/business-analyse/5-validate.md +0 -132
- package/templates/commands/business-analyse/6-handoff.md +0 -157
- package/templates/commands/business-analyse/7-doc-html.md +0 -103
- package/templates/commands/business-analyse/_shared.md +0 -176
- package/templates/commands/business-analyse/bug.md +0 -118
- package/templates/commands/business-analyse/change-request.md +0 -144
- package/templates/commands/business-analyse/hotfix.md +0 -116
- package/templates/commands/business-analyse.md +0 -121
- package/templates/commands/controller/create.md +0 -216
- package/templates/commands/controller/postman-templates.md +0 -528
- package/templates/commands/controller/templates.md +0 -600
- package/templates/commands/controller.md +0 -337
- package/templates/commands/create/agent.md +0 -138
- package/templates/commands/create/command.md +0 -166
- package/templates/commands/create/hook.md +0 -234
- package/templates/commands/create/plugin.md +0 -329
- package/templates/commands/create/project.md +0 -508
- package/templates/commands/create/skill.md +0 -199
- package/templates/commands/create.md +0 -220
- package/templates/commands/documentation/module.md +0 -202
- package/templates/commands/documentation/templates.md +0 -432
- package/templates/commands/documentation.md +0 -190
- package/templates/commands/epct.md +0 -69
- package/templates/commands/explain.md +0 -186
- package/templates/commands/feature-full.md +0 -267
- package/templates/commands/gitflow/1-init.md +0 -188
- package/templates/commands/gitflow/10-start.md +0 -190
- package/templates/commands/gitflow/11-finish.md +0 -382
- package/templates/commands/gitflow/12-cleanup.md +0 -103
- package/templates/commands/gitflow/13-sync.md +0 -216
- package/templates/commands/gitflow/14-rebase.md +0 -251
- package/templates/commands/gitflow/2-status.md +0 -122
- package/templates/commands/gitflow/3-commit.md +0 -209
- package/templates/commands/gitflow/4-plan.md +0 -174
- package/templates/commands/gitflow/5-exec.md +0 -202
- package/templates/commands/gitflow/6-abort.md +0 -121
- package/templates/commands/gitflow/7-pull-request.md +0 -176
- package/templates/commands/gitflow/8-review.md +0 -113
- package/templates/commands/gitflow/9-merge.md +0 -157
- package/templates/commands/gitflow.md +0 -128
- package/templates/commands/implement.md +0 -663
- package/templates/commands/init.md +0 -567
- package/templates/commands/mcp-integration.md +0 -330
- package/templates/commands/notification.md +0 -129
- package/templates/commands/oneshot.md +0 -57
- package/templates/commands/quickstart.md +0 -154
- package/templates/commands/ralph-loop/cancel-ralph.md +0 -18
- package/templates/commands/ralph-loop/help.md +0 -126
- package/templates/commands/ralph-loop/ralph-loop.md +0 -120
- package/templates/commands/review.md +0 -106
- package/templates/commands/workflow.md +0 -193
package/package.json
CHANGED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-reviewer
|
|
3
|
+
description: Expert code reviewer for PR analysis. Use when reviewing code changes for security, logic, clean code, or feature-specific behavior. Accepts focus area and file list. Returns structured findings table.
|
|
4
|
+
tools: Read, Grep, Glob, Skill
|
|
5
|
+
model: haiku
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<role>
|
|
9
|
+
You are a senior code reviewer specialized in finding high-impact issues. You MUST load the review-code skill first for comprehensive guidance, then analyze the provided files.
|
|
10
|
+
</role>
|
|
11
|
+
|
|
12
|
+
<first_action>
|
|
13
|
+
**ALWAYS start by loading the review-code skill:**
|
|
14
|
+
```
|
|
15
|
+
Skill tool: review-code
|
|
16
|
+
```
|
|
17
|
+
This gives you access to security checklists, clean code principles, and feedback patterns.
|
|
18
|
+
</first_action>
|
|
19
|
+
|
|
20
|
+
<input_format>
|
|
21
|
+
You will receive a structured review request in XML format:
|
|
22
|
+
|
|
23
|
+
```xml
|
|
24
|
+
<review_request>
|
|
25
|
+
<focus_area>{security | feature-logic | clean-code | tests | general}</focus_area>
|
|
26
|
+
|
|
27
|
+
<files>
|
|
28
|
+
<file path="src/example.ts" />
|
|
29
|
+
<file path="src/other.ts" />
|
|
30
|
+
</files>
|
|
31
|
+
|
|
32
|
+
<!-- For feature-logic focus only -->
|
|
33
|
+
<feature_context>
|
|
34
|
+
<name>Feature Name</name>
|
|
35
|
+
<description>What this feature does</description>
|
|
36
|
+
<expected_behavior>
|
|
37
|
+
- Behavior 1
|
|
38
|
+
- Behavior 2
|
|
39
|
+
</expected_behavior>
|
|
40
|
+
</feature_context>
|
|
41
|
+
|
|
42
|
+
<!-- Optional -->
|
|
43
|
+
<pr_context>
|
|
44
|
+
<title>PR Title</title>
|
|
45
|
+
<description>PR Description</description>
|
|
46
|
+
</pr_context>
|
|
47
|
+
</review_request>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Parse this input to extract:**
|
|
51
|
+
1. **focus_area**: Which checks to apply
|
|
52
|
+
2. **files**: List of file paths to read and review
|
|
53
|
+
3. **feature_context**: (if present) Expected behavior to verify
|
|
54
|
+
4. **pr_context**: (if present) Requirements to check against
|
|
55
|
+
</input_format>
|
|
56
|
+
|
|
57
|
+
<focus_areas>
|
|
58
|
+
<area name="security">
|
|
59
|
+
- Hardcoded credentials (search: `password.*=`, `api[_-]?key`, `secret.*=`)
|
|
60
|
+
- SQL injection (string concatenation in queries)
|
|
61
|
+
- XSS vulnerabilities (unescaped user input)
|
|
62
|
+
- Auth bypass (missing authorization checks)
|
|
63
|
+
- Dangerous functions (`eval`, `exec`, `system`)
|
|
64
|
+
- Input validation gaps
|
|
65
|
+
</area>
|
|
66
|
+
|
|
67
|
+
<area name="feature-logic">
|
|
68
|
+
- Business logic matches requirements
|
|
69
|
+
- Edge cases handled (null, empty, boundary)
|
|
70
|
+
- Error handling present and correct
|
|
71
|
+
- Race conditions in async code
|
|
72
|
+
- State management correctness
|
|
73
|
+
- API contract compliance
|
|
74
|
+
</area>
|
|
75
|
+
|
|
76
|
+
<area name="clean-code">
|
|
77
|
+
- Functions >50 lines (violate SRP)
|
|
78
|
+
- Nesting >3 levels (extract to functions)
|
|
79
|
+
- Code duplication >20 lines
|
|
80
|
+
- Long parameter lists (>3 params)
|
|
81
|
+
- Cognitive complexity >15
|
|
82
|
+
- SOLID violations
|
|
83
|
+
</area>
|
|
84
|
+
|
|
85
|
+
<area name="tests">
|
|
86
|
+
- Tests exist for new functionality
|
|
87
|
+
- Edge cases covered
|
|
88
|
+
- Error paths tested
|
|
89
|
+
- Mocks used appropriately
|
|
90
|
+
- Test isolation
|
|
91
|
+
</area>
|
|
92
|
+
|
|
93
|
+
<area name="general">
|
|
94
|
+
- Combine all focus areas
|
|
95
|
+
- Prioritize: Security > Logic > Clean Code > Tests
|
|
96
|
+
</area>
|
|
97
|
+
</focus_areas>
|
|
98
|
+
|
|
99
|
+
<workflow>
|
|
100
|
+
1. **Load skill**: Use Skill tool to load `review-code` for guidance
|
|
101
|
+
2. **Read files**: Read all provided files completely
|
|
102
|
+
3. **Analyze by focus**: Apply checks from the loaded skill based on focus area
|
|
103
|
+
4. **Filter findings**: Only include HIGH-IMPACT issues (no nitpicks)
|
|
104
|
+
5. **Format output**: Return structured table with findings
|
|
105
|
+
</workflow>
|
|
106
|
+
|
|
107
|
+
<output_format>
|
|
108
|
+
Return findings in this exact format:
|
|
109
|
+
|
|
110
|
+
```markdown
|
|
111
|
+
## Review: {focus_area}
|
|
112
|
+
|
|
113
|
+
**Files reviewed**: {count}
|
|
114
|
+
**Issues found**: {count}
|
|
115
|
+
|
|
116
|
+
| Severity | Issue | Location | Why It Matters | Fix |
|
|
117
|
+
|----------|-------|----------|----------------|-----|
|
|
118
|
+
| BLOCKING | {description} | `file.ts:42` | {impact} | {suggestion} |
|
|
119
|
+
| CRITICAL | {description} | `file.ts:67` | {impact} | {suggestion} |
|
|
120
|
+
| SUGGESTION | {description} | `file.ts:89` | {benefit} | {suggestion} |
|
|
121
|
+
|
|
122
|
+
### Summary
|
|
123
|
+
{1-2 sentence summary of findings}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Severity levels:**
|
|
127
|
+
- `BLOCKING`: Security vulnerabilities, logic bugs - must fix
|
|
128
|
+
- `CRITICAL`: Architecture problems, major code smells - strongly recommended
|
|
129
|
+
- `SUGGESTION`: Improvements that would help - optional
|
|
130
|
+
</output_format>
|
|
131
|
+
|
|
132
|
+
<filtering_rules>
|
|
133
|
+
**INCLUDE:**
|
|
134
|
+
- Security vulnerabilities (any)
|
|
135
|
+
- Logic errors
|
|
136
|
+
- Missing error handling for likely cases
|
|
137
|
+
- Code duplication >20 lines
|
|
138
|
+
- Functions >50 lines with multiple responsibilities
|
|
139
|
+
- Missing tests for critical paths
|
|
140
|
+
|
|
141
|
+
**EXCLUDE (nitpicks):**
|
|
142
|
+
- Formatting/whitespace
|
|
143
|
+
- Minor naming preferences
|
|
144
|
+
- "Could be cleaner" without specific issue
|
|
145
|
+
- Subjective style preferences
|
|
146
|
+
- Comments on unchanged code
|
|
147
|
+
</filtering_rules>
|
|
148
|
+
|
|
149
|
+
<constraints>
|
|
150
|
+
- NEVER include nitpicks or style comments
|
|
151
|
+
- ALWAYS load the review-code skill first
|
|
152
|
+
- ALWAYS provide What + Why + Fix for each issue
|
|
153
|
+
- NEVER comment on code outside the provided files
|
|
154
|
+
- If no issues found, say "No high-impact issues found" with brief explanation
|
|
155
|
+
</constraints>
|
|
156
|
+
|
|
157
|
+
<success_criteria>
|
|
158
|
+
- Skill loaded and guidance applied
|
|
159
|
+
- All provided files reviewed
|
|
160
|
+
- Only high-impact issues reported
|
|
161
|
+
- Each finding has: Severity, Issue, Location, Why, Fix
|
|
162
|
+
- Output in structured table format
|
|
163
|
+
</success_criteria>
|
|
@@ -13,9 +13,18 @@ Applies pending migrations to the local database.
|
|
|
13
13
|
## Workflow
|
|
14
14
|
|
|
15
15
|
1. **Verify** appsettings.Local.json exists
|
|
16
|
-
2. **
|
|
17
|
-
3. **
|
|
18
|
-
4. **
|
|
16
|
+
2. **Detect** available DbContexts (CoreDbContext, ExtensionsDbContext)
|
|
17
|
+
3. **Count** pending migrations per context
|
|
18
|
+
4. **Apply** migrations in order: Core first, then Extensions
|
|
19
|
+
5. **Confirm** success
|
|
20
|
+
|
|
21
|
+
## Dual DbContext Order
|
|
22
|
+
|
|
23
|
+
**IMPORTANT:** Migrations must be applied in order:
|
|
24
|
+
1. **CoreDbContext** first (SmartStack platform tables)
|
|
25
|
+
2. **ExtensionsDbContext** second (client tables that may reference Core)
|
|
26
|
+
|
|
27
|
+
This ensures FK references from Extensions to Core work correctly.
|
|
19
28
|
|
|
20
29
|
## Commands
|
|
21
30
|
|
|
@@ -23,8 +32,11 @@ Applies pending migrations to the local database.
|
|
|
23
32
|
# Verify config
|
|
24
33
|
test -f appsettings.Local.json && echo "OK" || echo "MISSING"
|
|
25
34
|
|
|
26
|
-
# Apply
|
|
27
|
-
dotnet ef database update --verbose
|
|
35
|
+
# Apply Core migrations first
|
|
36
|
+
dotnet ef database update --context CoreDbContext --verbose
|
|
37
|
+
|
|
38
|
+
# Then apply Extensions migrations
|
|
39
|
+
dotnet ef database update --context ExtensionsDbContext --verbose
|
|
28
40
|
```
|
|
29
41
|
|
|
30
42
|
## Output Format
|
|
@@ -32,8 +44,14 @@ dotnet ef database update --verbose
|
|
|
32
44
|
```
|
|
33
45
|
DB DEPLOY
|
|
34
46
|
Config: appsettings.Local.json
|
|
35
|
-
|
|
36
|
-
|
|
47
|
+
|
|
48
|
+
CORE CONTEXT
|
|
49
|
+
Applied: {n} migration(s)
|
|
50
|
+
Status: {success|error}
|
|
51
|
+
|
|
52
|
+
EXTENSIONS CONTEXT
|
|
53
|
+
Applied: {n} migration(s)
|
|
54
|
+
Status: {success|error|skipped}
|
|
37
55
|
```
|
|
38
56
|
|
|
39
57
|
## Error Handling
|
|
@@ -15,7 +15,7 @@ tools: Bash, Glob, Read
|
|
|
15
15
|
## Workflow
|
|
16
16
|
|
|
17
17
|
1. **CONFIRM** with user (mandatory)
|
|
18
|
-
2. **Backup**
|
|
18
|
+
2. **Backup** automatic via sqlcmd (ask user)
|
|
19
19
|
3. **Drop** database
|
|
20
20
|
4. **Recreate** with all migrations
|
|
21
21
|
5. **Seed** optional
|
|
@@ -32,24 +32,45 @@ AskUserQuestion({
|
|
|
32
32
|
## Commands
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
#
|
|
36
|
-
|
|
35
|
+
# Backup (before drop - recommended)
|
|
36
|
+
BACKUP_DIR=".claude/gitflow/backup/database"
|
|
37
|
+
mkdir -p "$BACKUP_DIR"
|
|
38
|
+
BACKUP_FILE="${BACKUP_DIR}/${DATABASE_NAME}_$(date +%Y%m%d_%H%M%S).bak"
|
|
39
|
+
sqlcmd -S "$SERVER_NAME" -E -Q "BACKUP DATABASE [$DATABASE_NAME] TO DISK='$BACKUP_FILE' WITH FORMAT, INIT, COMPRESSION"
|
|
37
40
|
|
|
38
|
-
#
|
|
39
|
-
dotnet ef database
|
|
41
|
+
# Drop (single database, both schemas)
|
|
42
|
+
dotnet ef database drop --force
|
|
40
43
|
|
|
41
|
-
#
|
|
42
|
-
|
|
44
|
+
# Recreate - apply Core first, then Extensions
|
|
45
|
+
dotnet ef database update --context CoreDbContext
|
|
46
|
+
dotnet ef database update --context ExtensionsDbContext
|
|
43
47
|
```
|
|
44
48
|
|
|
49
|
+
## Dual DbContext Notes
|
|
50
|
+
|
|
51
|
+
When resetting the database:
|
|
52
|
+
1. **Drop** removes both schemas (core and extensions)
|
|
53
|
+
2. **Recreate Core first** - platform tables
|
|
54
|
+
3. **Then Extensions** - client tables that may reference Core
|
|
55
|
+
|
|
56
|
+
Both contexts share the same physical database but use different schemas.
|
|
57
|
+
|
|
45
58
|
## Output Format
|
|
46
59
|
|
|
47
60
|
```
|
|
48
61
|
DB RESET
|
|
49
62
|
Action: Drop + Recreate
|
|
50
|
-
Backup: {
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
Backup: {.claude/gitflow/backup/database/DB_YYYYMMDD_HHMMSS.bak|none}
|
|
64
|
+
|
|
65
|
+
CORE CONTEXT
|
|
66
|
+
Migrations: {n} applied
|
|
67
|
+
Schema: core
|
|
68
|
+
Status: {success|error}
|
|
69
|
+
|
|
70
|
+
EXTENSIONS CONTEXT
|
|
71
|
+
Migrations: {n} applied
|
|
72
|
+
Schema: extensions
|
|
73
|
+
Status: {success|error}
|
|
53
74
|
```
|
|
54
75
|
|
|
55
76
|
## Safety
|
|
@@ -49,16 +49,33 @@ git branch --show-current
|
|
|
49
49
|
EF CORE - DATABASE STATUS
|
|
50
50
|
================================================================================
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
CORE CONTEXT (CoreDbContext)
|
|
53
|
+
Schema: core
|
|
54
|
+
History: core.__EFMigrationsHistory
|
|
54
55
|
Migrations: {applied}/{total} | {pending} pending
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
|
|
57
|
+
EXTENSIONS CONTEXT (ExtensionsDbContext)
|
|
58
|
+
Schema: extensions
|
|
59
|
+
History: extensions.__EFMigrationsHistory
|
|
60
|
+
Migrations: {applied}/{total} | {pending} pending
|
|
61
|
+
|
|
62
|
+
BRANCH STATUS
|
|
63
|
+
Branch: {branch}
|
|
64
|
+
Core migrations: {n}
|
|
65
|
+
Extensions migrations: {n}
|
|
66
|
+
Naming: {ok|warnings}
|
|
67
|
+
1-migration rule: {ok|warning}
|
|
58
68
|
|
|
59
69
|
================================================================================
|
|
60
70
|
```
|
|
61
71
|
|
|
72
|
+
## Dual DbContext Notes
|
|
73
|
+
|
|
74
|
+
- **Core migrations** use `--context CoreDbContext`
|
|
75
|
+
- **Extensions migrations** use `--context ExtensionsDbContext`
|
|
76
|
+
- Each context has its own `__EFMigrationsHistory` table
|
|
77
|
+
- Check both contexts when verifying migration status
|
|
78
|
+
|
|
62
79
|
## Priority
|
|
63
80
|
|
|
64
81
|
Speed > Detail. Use MCP for structured data, dotnet ef for connection test.
|
|
@@ -12,26 +12,44 @@ Manages migration creation with the "1 migration per feature" rule.
|
|
|
12
12
|
|
|
13
13
|
> **CLAUDE INSTRUCTION:** The `AskUserQuestion({...})` blocks are instructions to use the `AskUserQuestion` tool **interactively**. You MUST execute the tool with these parameters to get the user's response BEFORE continuing.
|
|
14
14
|
|
|
15
|
+
## Dual DbContext Architecture
|
|
16
|
+
|
|
17
|
+
SmartStack uses two separate DbContexts with separate migration histories:
|
|
18
|
+
|
|
19
|
+
| Context | DbContext | Schema | History Table | Use Case |
|
|
20
|
+
|---------|-----------|--------|---------------|----------|
|
|
21
|
+
| `core` | CoreDbContext | `core` | `core.__EFMigrationsHistory` | SmartStack platform entities |
|
|
22
|
+
| `extensions` | ExtensionsDbContext | `extensions` | `extensions.__EFMigrationsHistory` | Client-specific entities |
|
|
23
|
+
|
|
24
|
+
**Detection Logic:**
|
|
25
|
+
1. If project contains `SmartStack.Domain` → use `CoreDbContext`
|
|
26
|
+
2. If project contains `{ClientName}.Domain` with SmartStack NuGet → use `ExtensionsDbContext`
|
|
27
|
+
3. If unclear → ask user which context to use
|
|
28
|
+
|
|
15
29
|
## Workflow
|
|
16
30
|
|
|
17
|
-
1. **
|
|
18
|
-
2. **
|
|
19
|
-
3. **
|
|
20
|
-
4. **
|
|
21
|
-
5. **
|
|
22
|
-
6. **
|
|
23
|
-
7. **
|
|
31
|
+
1. **Detect** DbContext type (Core vs Extensions)
|
|
32
|
+
2. **Analyze** current branch (feature/hotfix/release)
|
|
33
|
+
3. **Extract** version from package.json or *.csproj
|
|
34
|
+
4. **Search** for existing migration for this branch
|
|
35
|
+
5. **If exists**: propose to recreate (delete + create)
|
|
36
|
+
6. **Generate** name: `{context}_v{version}_{sequence}_{Description}`
|
|
37
|
+
7. **Create** migration with `dotnet ef migrations add --context {DbContext}`
|
|
38
|
+
8. **Validate** generated content
|
|
24
39
|
|
|
25
40
|
## Naming Pattern
|
|
26
41
|
|
|
27
42
|
```
|
|
28
|
-
{
|
|
43
|
+
{context}_v{version}_{sequence}_{Description}
|
|
29
44
|
```
|
|
30
45
|
|
|
31
|
-
|
|
32
|
-
- `
|
|
33
|
-
- `
|
|
34
|
-
|
|
46
|
+
**Core migrations:**
|
|
47
|
+
- `core_v1.8.0_001_CreateAuthUsers`
|
|
48
|
+
- `core_v1.8.0_002_AddEntraSync`
|
|
49
|
+
|
|
50
|
+
**Extensions migrations:**
|
|
51
|
+
- `ext_v1.0.0_001_CreateOrders`
|
|
52
|
+
- `ext_v1.0.0_002_AddOrderItems`
|
|
35
53
|
|
|
36
54
|
## Commands
|
|
37
55
|
|
|
@@ -42,26 +60,47 @@ git branch --show-current
|
|
|
42
60
|
# Version
|
|
43
61
|
grep -oP '"version":\s*"\K[^"]+' package.json
|
|
44
62
|
|
|
45
|
-
# Existing migrations
|
|
46
|
-
find Migrations -name "*.cs" | grep -v Designer | grep -v Snapshot
|
|
63
|
+
# Existing migrations for Core
|
|
64
|
+
find Migrations -name "core_*.cs" | grep -v Designer | grep -v Snapshot
|
|
47
65
|
|
|
48
|
-
#
|
|
49
|
-
|
|
66
|
+
# Existing migrations for Extensions
|
|
67
|
+
find Migrations -name "ext_*.cs" | grep -v Designer | grep -v Snapshot
|
|
68
|
+
|
|
69
|
+
# Create Core migration
|
|
70
|
+
dotnet ef migrations add $MIGRATION_NAME --context CoreDbContext
|
|
71
|
+
|
|
72
|
+
# Create Extensions migration
|
|
73
|
+
dotnet ef migrations add $MIGRATION_NAME --context ExtensionsDbContext
|
|
50
74
|
|
|
51
75
|
# Delete
|
|
52
76
|
rm Migrations/*${OLD_NAME}*.cs
|
|
53
77
|
```
|
|
54
78
|
|
|
79
|
+
## Context Detection
|
|
80
|
+
|
|
81
|
+
If unable to auto-detect:
|
|
82
|
+
```javascript
|
|
83
|
+
AskUserQuestion({
|
|
84
|
+
question: "Which DbContext should this migration target?",
|
|
85
|
+
header: "DbContext",
|
|
86
|
+
options: [
|
|
87
|
+
{ label: "CoreDbContext (SmartStack)", description: "For platform entities (User, Role, Navigation, etc.)" },
|
|
88
|
+
{ label: "ExtensionsDbContext (Client)", description: "For client-specific entities" }
|
|
89
|
+
]
|
|
90
|
+
})
|
|
91
|
+
```
|
|
92
|
+
|
|
55
93
|
## 1 Migration per Feature Rule
|
|
56
94
|
|
|
57
95
|
If existing migration detected:
|
|
58
96
|
```javascript
|
|
59
97
|
AskUserQuestion({
|
|
60
98
|
question: "Existing migration found. Recreate?",
|
|
99
|
+
header: "Migration",
|
|
61
100
|
options: [
|
|
62
|
-
"Recreate (recommended)",
|
|
63
|
-
"Keep and add new",
|
|
64
|
-
"Cancel"
|
|
101
|
+
{ label: "Recreate (recommended)", description: "Delete existing and create new" },
|
|
102
|
+
{ label: "Keep and add new", description: "Keep existing, add separate migration" },
|
|
103
|
+
{ label: "Cancel", description: "Do nothing" }
|
|
65
104
|
]
|
|
66
105
|
})
|
|
67
106
|
```
|
|
@@ -70,11 +109,14 @@ AskUserQuestion({
|
|
|
70
109
|
|
|
71
110
|
```
|
|
72
111
|
MIGRATION
|
|
112
|
+
Context: {CoreDbContext|ExtensionsDbContext}
|
|
113
|
+
Schema: {core|extensions}
|
|
73
114
|
Branch: {branch}
|
|
74
115
|
Version: {version}
|
|
75
116
|
Name: {migration_name}
|
|
76
117
|
Action: {created|recreated}
|
|
77
118
|
Files: 3 (Migration + Designer + Snapshot)
|
|
119
|
+
HistoryTable: {schema}.__EFMigrationsHistory
|
|
78
120
|
```
|
|
79
121
|
|
|
80
122
|
## Conflict Management
|
|
@@ -83,3 +125,11 @@ After rebase on develop:
|
|
|
83
125
|
1. Accept ModelSnapshot from develop
|
|
84
126
|
2. Delete local migration
|
|
85
127
|
3. Recreate with this command
|
|
128
|
+
|
|
129
|
+
## Important Notes
|
|
130
|
+
|
|
131
|
+
- **Core migrations** go to `CoreDbContextModelSnapshot.cs`
|
|
132
|
+
- **Extensions migrations** go to `ExtensionsDbContextModelSnapshot.cs`
|
|
133
|
+
- Each DbContext has its **own** `__EFMigrationsHistory` table in its schema
|
|
134
|
+
- Extensions entities **cannot** have navigation properties to Core entities
|
|
135
|
+
- Use `ICoreDataService` to access Core data from Extensions context
|
|
@@ -24,7 +24,14 @@ Audit et nettoyage des worktrees orphelins ou obsoletes.
|
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
# OBLIGATOIRE: Executer depuis main ou develop
|
|
27
|
-
|
|
27
|
+
# Detection robuste de la branche courante (compatible worktrees)
|
|
28
|
+
CURRENT_BRANCH=$(git branch --show-current 2>/dev/null)
|
|
29
|
+
if [ -z "$CURRENT_BRANCH" ]; then
|
|
30
|
+
CURRENT_BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null)
|
|
31
|
+
fi
|
|
32
|
+
if [ -z "$CURRENT_BRANCH" ]; then
|
|
33
|
+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
34
|
+
fi
|
|
28
35
|
if [[ "$CURRENT_BRANCH" != "main" && "$CURRENT_BRANCH" != "develop" ]]; then
|
|
29
36
|
echo "ERREUR: Cette commande doit etre executee depuis main ou develop"
|
|
30
37
|
exit 1
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: gitflow-commit
|
|
3
|
-
description: GitFlow commit with EF Core migration validation
|
|
3
|
+
description: GitFlow commit with EF Core migration validation (OPTIMISE)
|
|
4
4
|
color: green
|
|
5
|
-
model:
|
|
6
|
-
tools: Bash, Read, Glob, Grep
|
|
5
|
+
model: haiku
|
|
6
|
+
tools: Bash, Read, Glob, Grep
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
# GitFlow Commit Agent
|
|
9
|
+
# GitFlow Commit Agent (OPTIMISE)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Commit rapide avec validation migrations .NET.
|
|
12
|
+
|
|
13
|
+
> **OPTIMISATION:** Model haiku (validation simple), tools reduits (pas d'Edit).
|
|
12
14
|
|
|
13
15
|
## Workflow
|
|
14
16
|
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: gitflow-finish
|
|
3
|
-
description: GitFlow finish - finalize branch with tag and cleanup
|
|
3
|
+
description: GitFlow finish - finalize branch with tag and cleanup (OPTIMISE)
|
|
4
4
|
color: magenta
|
|
5
5
|
model: sonnet
|
|
6
|
-
tools: Bash, Read, Glob,
|
|
6
|
+
tools: Bash, Read, Glob, Write
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
# GitFlow Finish Agent
|
|
9
|
+
# GitFlow Finish Agent (OPTIMISE)
|
|
10
10
|
|
|
11
|
-
Finalisation
|
|
11
|
+
Finalisation rapide de branche GitFlow.
|
|
12
|
+
|
|
13
|
+
> **OPTIMISATION:** Model haiku (actions predefinies), tools reduits, workflow simplifie.
|
|
12
14
|
|
|
13
15
|
## MODE D'EXÉCUTION
|
|
14
16
|
|
|
@@ -21,7 +21,14 @@ Creation rapide de PR avec description auto-generee et detection automatique de
|
|
|
21
21
|
## Detection Cible (GitFlow Standard)
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
|
|
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
|
|
25
32
|
|
|
26
33
|
# Detection automatique selon le type de branche
|
|
27
34
|
if [[ "$CURRENT" == hotfix/* ]]; then
|