@atlashub/smartstack-cli 4.74.0 → 4.76.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/dist/index.js +152 -31
- package/dist/index.js.map +1 -1
- package/dist/mcp-entry.mjs +14 -3
- package/dist/mcp-entry.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/agents/ba-reader.md +17 -15
- package/templates/agents/ba-writer.md +49 -51
- package/templates/skills/apex/SKILL.md +2 -2
- package/templates/skills/apex/_shared.md +1 -1
- package/templates/skills/apex/references/checks/backend-checks.sh +21 -7
- package/templates/skills/apex/references/checks/frontend-checks.sh +26 -0
- package/templates/skills/apex/references/checks/infrastructure-checks.sh +47 -10
- package/templates/skills/apex/references/checks/seed-checks.sh +47 -7
- package/templates/skills/apex/references/core-seed-data.md +20 -18
- package/templates/skills/apex/references/frontend-route-wiring-app-tsx.md +3 -0
- package/templates/skills/apex/references/post-checks.md +23 -3
- package/templates/skills/apex/references/smartstack-api.md +4 -4
- package/templates/skills/apex/references/smartstack-frontend.md +54 -8
- package/templates/skills/apex/references/smartstack-layers.md +6 -6
- package/templates/skills/apex/steps/step-00-init.md +75 -1
- package/templates/skills/apex/steps/step-03-execute.md +16 -4
- package/templates/skills/apex/steps/step-03b-layer1-seed.md +65 -6
- package/templates/skills/apex/steps/step-03c-layer2-backend.md +50 -5
- package/templates/skills/apex/steps/step-03d-layer3-frontend.md +226 -4
- package/templates/skills/apex/steps/step-04-examine.md +163 -0
- package/templates/skills/apex-verify/SKILL.md +110 -0
- package/templates/skills/apex-verify/references/audit-rules.md +50 -0
- package/templates/skills/apex-verify/steps/step-00-init.md +119 -0
- package/templates/skills/apex-verify/steps/step-01-nav-audit.md +92 -0
- package/templates/skills/apex-verify/steps/step-02-crud-audit.md +127 -0
- package/templates/skills/apex-verify/steps/step-03-perm-audit.md +119 -0
- package/templates/skills/apex-verify/steps/step-04-route-audit.md +98 -0
- package/templates/skills/apex-verify/steps/step-05-report.md +110 -0
- package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +3 -0
- package/templates/skills/application/templates-frontend.md +2 -2
- package/templates/skills/business-analyse/SKILL.md +17 -3
- package/templates/skills/business-analyse/_shared.md +64 -0
- package/templates/skills/business-analyse/patterns/suggestion-catalog.md +34 -26
- package/templates/skills/business-analyse/questionnaire/01-context.md +13 -9
- package/templates/skills/business-analyse/questionnaire/02-stakeholders-scope.md +20 -27
- package/templates/skills/business-analyse/questionnaire.md +86 -9
- package/templates/skills/business-analyse/references/03-json-schemas.md +221 -0
- package/templates/skills/business-analyse/references/03-post-check-validation.md +208 -0
- package/templates/skills/business-analyse/references/03-smartstack-entity-guards.md +32 -0
- package/templates/skills/business-analyse/references/04-cross-module-validation.md +95 -0
- package/templates/skills/business-analyse/references/04-file-allocation.md +162 -0
- package/templates/skills/business-analyse/references/04-naming-audit-checks.md +174 -0
- package/templates/skills/business-analyse/references/04-semantic-validation-matrix.md +118 -0
- package/templates/skills/business-analyse/references/canonical-json-formats.md +7 -3
- package/templates/skills/business-analyse/references/domain-research-playbook.md +234 -0
- package/templates/skills/business-analyse/references/entity-sourcing-presentation.md +166 -0
- package/templates/skills/business-analyse/references/init-resume-logic.md +70 -0
- package/templates/skills/business-analyse/references/module-completeness-challenge.md +174 -0
- package/templates/skills/business-analyse/references/multi-app-detection.md +149 -0
- package/templates/skills/business-analyse/references/portal-classification.md +52 -0
- package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
- package/templates/skills/business-analyse/references/validation-checklist.md +35 -6
- package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +50 -6
- package/templates/skills/business-analyse/steps/step-00-init.md +22 -190
- package/templates/skills/business-analyse/steps/step-01-cadrage.md +365 -269
- package/templates/skills/business-analyse/steps/step-02-structure.md +98 -20
- package/templates/skills/business-analyse/steps/step-03-specify.md +810 -229
- package/templates/skills/business-analyse/steps/step-04-consolidate.md +509 -278
- package/templates/skills/business-analyse-design/SKILL.md +10 -0
- package/templates/skills/business-analyse-design/references/screens-post-check.md +221 -0
- package/templates/skills/business-analyse-design/references/screens-type-mapping.md +138 -0
- package/templates/skills/business-analyse-design/references/smartcomponents-templates.md +225 -0
- package/templates/skills/{business-analyse → business-analyse-design}/references/spec-auto-inference.md +117 -117
- package/templates/skills/business-analyse-design/steps/step-01-screens.md +36 -162
- package/templates/skills/business-analyse-design/steps/step-02-wireframes.md +8 -7
- package/templates/skills/business-analyse-design/steps/step-03-navigation.md +89 -42
- package/templates/skills/business-analyse-develop/references/compact-loop.md +9 -0
- package/templates/skills/business-analyse-develop/references/handoff-quality-gate.md +132 -0
- package/templates/skills/business-analyse-develop/references/prd-v3-transformation.md +326 -0
- package/templates/skills/business-analyse-develop/references/report-reconciliation.md +140 -0
- package/templates/skills/business-analyse-develop/references/report-template.md +142 -0
- package/templates/skills/business-analyse-develop/steps/step-01-task.md +5 -177
- package/templates/skills/business-analyse-develop/steps/step-02-execute.md +17 -4
- package/templates/skills/business-analyse-develop/steps/step-03-commit.md +6 -2
- package/templates/skills/business-analyse-develop/steps/step-04-check.md +6 -0
- package/templates/skills/business-analyse-develop/steps/step-05-report.md +3 -269
- package/templates/skills/business-analyse-handoff/SKILL.md +10 -0
- package/templates/skills/business-analyse-handoff/references/agent-handoff-transform-prompt.md +211 -0
- package/templates/skills/business-analyse-handoff/references/context-isolation-pattern.md +47 -0
- package/templates/skills/business-analyse-handoff/references/handoff-file-inventory.md +49 -0
- package/templates/skills/business-analyse-handoff/references/handoff-global-validation.md +142 -0
- package/templates/skills/business-analyse-handoff/references/prd-validation-checks.md +125 -0
- package/templates/skills/business-analyse-handoff/references/project-index-update.md +98 -0
- package/templates/skills/business-analyse-handoff/steps/step-01-transform.md +9 -160
- package/templates/skills/business-analyse-handoff/steps/step-02-export.md +10 -99
- package/templates/skills/business-analyse-html/SKILL.md +10 -0
- package/templates/skills/business-analyse-html/html/ba-interactive.html +504 -97
- package/templates/skills/business-analyse-html/html/src/scripts/01-data-init.js +79 -2
- package/templates/skills/business-analyse-html/html/src/scripts/02-navigation.js +6 -46
- package/templates/skills/business-analyse-html/html/src/scripts/05-render-specs.js +80 -11
- package/templates/skills/business-analyse-html/html/src/scripts/06-render-consolidation.js +2 -2
- package/templates/skills/business-analyse-html/html/src/scripts/06-render-mockups.js +94 -36
- package/templates/skills/business-analyse-html/html/src/scripts/12-render-diagrams.js +162 -0
- package/templates/skills/business-analyse-html/html/src/styles/10-diagrams.css +73 -0
- package/templates/skills/business-analyse-html/html/src/template.html +2 -0
- package/templates/skills/business-analyse-html/references/02-embedded-artifacts-building.md +144 -0
- package/templates/skills/business-analyse-html/references/02-feature-data-building.md +143 -0
- package/templates/skills/business-analyse-html/references/02-mapping-tables.md +442 -0
- package/templates/skills/business-analyse-html/references/02-normalization-helpers.md +139 -0
- package/templates/skills/business-analyse-html/references/02-screen-format-detection.md +283 -0
- package/templates/skills/business-analyse-html/references/02-self-check-validation.md +199 -0
- package/templates/skills/business-analyse-html/references/data-build.md +24 -1
- package/templates/skills/business-analyse-html/references/data-mapping.md +119 -17
- package/templates/skills/business-analyse-html/steps/step-02-build-data.md +18 -555
- package/templates/skills/business-analyse-html/steps/step-04-verify.md +92 -3
- package/templates/skills/business-analyse-quick/SKILL.md +807 -0
- package/templates/skills/{sketch → business-analyse-quick}/references/domain-heuristics.md +59 -3
- package/templates/skills/business-analyse-quick/references/prd-schema.md +268 -0
- package/templates/skills/business-analyse-review/SKILL.md +10 -0
- package/templates/skills/business-analyse-review/references/review-data-mapping.md +6 -0
- package/templates/skills/business-analyse-status/SKILL.md +8 -0
- package/templates/skills/dev-start/SKILL.md +143 -307
- package/templates/skills/efcore/SKILL.md +13 -0
- package/templates/skills/sketch/SKILL.md +15 -153
- package/templates/skills/ui-components/SKILL.md +1 -1
- package/templates/skills/ui-components/patterns/data-table.md +1 -1
|
@@ -3,7 +3,7 @@ name: dev-start
|
|
|
3
3
|
description: Launch SmartStack dev environment (backend + frontend + admin credentials)
|
|
4
4
|
argument-hint: "[--stop] [--reset] [--backend-only] [--frontend-only]"
|
|
5
5
|
model: haiku
|
|
6
|
-
allowed-tools: Read, Bash,
|
|
6
|
+
allowed-tools: Read, Bash, Write, TaskOutput
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## Arguments
|
|
@@ -16,345 +16,189 @@ $ARGUMENTS
|
|
|
16
16
|
- Ports running: !`netstat.exe -ano 2>/dev/null | grep -E "LISTENING" | grep -E ":(5[0-9]{3}|6173|3000) " | head -5 || echo "none"`
|
|
17
17
|
|
|
18
18
|
<objective>
|
|
19
|
-
Launch
|
|
20
|
-
Idempotent: safe to run multiple times. Detects already-running processes.
|
|
21
|
-
Uses a config cache to skip re-detection on subsequent runs when config files haven't changed.
|
|
19
|
+
Launch SmartStack dev environment FAST. The injected state above is already loaded — use it directly, never re-read those files. Target: 0 tool calls if everything running, 2-3 to launch, 5 max cold start.
|
|
22
20
|
</objective>
|
|
23
21
|
|
|
24
22
|
<quick_start>
|
|
25
23
|
```bash
|
|
26
|
-
/dev-start # Launch
|
|
27
|
-
/dev-start --stop # Stop
|
|
28
|
-
/dev-start --reset # Force
|
|
29
|
-
/dev-start --backend-only # Launch only
|
|
30
|
-
/dev-start --frontend-only # Launch only
|
|
24
|
+
/dev-start # Launch all (idempotent, reuses cache+session)
|
|
25
|
+
/dev-start --stop # Stop all services
|
|
26
|
+
/dev-start --reset # Force re-detect config + reset password
|
|
27
|
+
/dev-start --backend-only # Launch backend only
|
|
28
|
+
/dev-start --frontend-only # Launch frontend only
|
|
31
29
|
```
|
|
32
30
|
</quick_start>
|
|
33
31
|
|
|
34
32
|
<subcommands>
|
|
35
33
|
|
|
36
|
-
| Command |
|
|
37
|
-
|
|
38
|
-
| `/dev-start` | Launch all (
|
|
39
|
-
| `/dev-start --stop` |
|
|
40
|
-
| `/dev-start --reset` |
|
|
41
|
-
| `/dev-start --backend-only` | Launch only
|
|
42
|
-
| `/dev-start --frontend-only` | Launch only
|
|
34
|
+
| Command | Effect |
|
|
35
|
+
|---------|--------|
|
|
36
|
+
| `/dev-start` | Launch all services (0 tool calls if all running) |
|
|
37
|
+
| `/dev-start --stop` | Kill backend + frontend |
|
|
38
|
+
| `/dev-start --reset` | Re-detect config + reset admin password |
|
|
39
|
+
| `/dev-start --backend-only` | Launch backend only |
|
|
40
|
+
| `/dev-start --frontend-only` | Launch frontend only |
|
|
43
41
|
|
|
44
42
|
</subcommands>
|
|
45
43
|
|
|
46
44
|
<workflow>
|
|
47
45
|
|
|
48
|
-
## Handle --stop
|
|
46
|
+
## Handle --stop (Exit After)
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
1. Determine ports to stop:
|
|
53
|
-
- If `.claude/config/dev-run.json` exists → read `api_port` and `web_port` from cache
|
|
54
|
-
- Otherwise → scan default ports: 5142, 5290 (API) and 6173, 3000 (Web)
|
|
55
|
-
|
|
56
|
-
2. Find backend PID:
|
|
57
|
-
```bash
|
|
58
|
-
netstat.exe -ano | grep ":${API_PORT} .*LISTENING" | awk '{print $5}' | head -1
|
|
59
|
-
```
|
|
60
|
-
3. If found: `taskkill.exe /PID $PID /F`
|
|
61
|
-
4. Find frontend PID:
|
|
62
|
-
```bash
|
|
63
|
-
netstat.exe -ano | grep ":${WEB_PORT} .*LISTENING" | awk '{print $5}' | head -1
|
|
64
|
-
```
|
|
65
|
-
5. If found: `taskkill.exe /PID $PID /F`
|
|
66
|
-
6. Display stopped status and exit.
|
|
67
|
-
|
|
68
|
-
If no processes found, display "Nothing running" and exit.
|
|
69
|
-
|
|
70
|
-
## Step 0: Load cache
|
|
71
|
-
|
|
72
|
-
If `--stop` argument → skip this step entirely (--stop uses netstat only).
|
|
73
|
-
|
|
74
|
-
1. Read cache file:
|
|
75
|
-
```bash
|
|
76
|
-
cat .claude/config/dev-run.json 2>/dev/null
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
2. **If no cache OR `--reset` argument** → CACHE_HIT=false, go to Step 1.
|
|
80
|
-
|
|
81
|
-
3. **If cache exists**, verify config files haven't changed:
|
|
82
|
-
```bash
|
|
83
|
-
API_DIR=$(grep -o '"api_dir": *"[^"]*"' .claude/config/dev-run.json | cut -d'"' -f4)
|
|
84
|
-
WEB_DIR=$(grep -o '"web_dir": *"[^"]*"' .claude/config/dev-run.json | cut -d'"' -f4)
|
|
85
|
-
MODE=$(grep -o '"mode": *"[^"]*"' .claude/config/dev-run.json | cut -d'"' -f4)
|
|
86
|
-
|
|
87
|
-
if [ "$MODE" = "Local" ]; then
|
|
88
|
-
CURRENT_HASH=$(stat -c %Y "$API_DIR/appsettings.Local.json" "$WEB_DIR/.env.standalone" "$API_DIR/Properties/launchSettings.json" 2>/dev/null | md5sum | cut -d' ' -f1)
|
|
89
|
-
else
|
|
90
|
-
CURRENT_HASH=$(stat -c %Y "$API_DIR/appsettings.json" "$WEB_DIR/.env.development" "$API_DIR/Properties/launchSettings.json" 2>/dev/null | md5sum | cut -d' ' -f1)
|
|
91
|
-
fi
|
|
92
|
-
|
|
93
|
-
CACHED_HASH=$(grep -o '"config_hash": *"[^"]*"' .claude/config/dev-run.json | cut -d'"' -f4)
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
4. **If CURRENT_HASH = CACHED_HASH** → CACHE_HIT=true :
|
|
97
|
-
- Load all values from cache (api_dir, web_dir, mode, ports, commands, sql_status)
|
|
98
|
-
- Display: `[CACHE] Using cached config (from {cached_at})`
|
|
99
|
-
- **Skip directly to Step 4** (check if already running)
|
|
100
|
-
|
|
101
|
-
5. **If hash mismatch** → CACHE_HIT=false :
|
|
102
|
-
- Display: `[CACHE] Config changed, re-detecting...`
|
|
103
|
-
- Continue to Step 1
|
|
104
|
-
|
|
105
|
-
## Step 1: Detect project
|
|
106
|
-
|
|
107
|
-
**Skip if CACHE_HIT=true (values loaded from cache in Step 0).**
|
|
108
|
-
|
|
109
|
-
Find the API and Web directories using bash (Glob doesn't match directories):
|
|
48
|
+
Extract api_port, web_port from injected cache (default 5142, 6173). Single Bash:
|
|
110
49
|
```bash
|
|
111
|
-
|
|
112
|
-
|
|
50
|
+
AP={api_port from cache, default 5142}
|
|
51
|
+
WP={web_port from cache, default 6173}
|
|
52
|
+
APID=$(netstat.exe -ano | grep ":${AP} .*LISTENING" | awk '{print $5}' | head -1)
|
|
53
|
+
WPID=$(netstat.exe -ano | grep ":${WP} .*LISTENING" | awk '{print $5}' | head -1)
|
|
54
|
+
[ -n "$APID" ] && taskkill.exe /PID $APID /F 2>&1 && echo "Backend stopped (PID $APID)"
|
|
55
|
+
[ -n "$WPID" ] && taskkill.exe /PID $WPID /F 2>&1 && echo "Frontend stopped (PID $WPID)"
|
|
56
|
+
[ -z "$APID" ] && [ -z "$WPID" ] && echo "Nothing running"
|
|
113
57
|
```
|
|
58
|
+
Display result. Done. Exit.
|
|
114
59
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
## Step 2: Detect environment and ports
|
|
118
|
-
|
|
119
|
-
**Skip if CACHE_HIT=true (values loaded from cache in Step 0).**
|
|
60
|
+
---
|
|
120
61
|
|
|
121
|
-
|
|
62
|
+
## Step 0: Cache Decision
|
|
122
63
|
|
|
123
|
-
|
|
124
|
-
|-----------|------|---------|----------|-----------------|------------------|
|
|
125
|
-
| `appsettings.Local.json` exists | **Local** | Port from `Kestrel:Endpoints:Http:Url` | Port from `.env.standalone` or `package.json` local script | `dotnet run --launch-profile Local` | `npm run local` |
|
|
126
|
-
| No local config | **Development** | Port 5142 (launchSettings http profile) | Port 6173 (vite default) | `dotnet run --environment Development` | `npm run dev` |
|
|
64
|
+
**CRITICAL: The injected state above IS your data source. NEVER re-read cache or session files.**
|
|
127
65
|
|
|
128
|
-
**
|
|
129
|
-
- **Local backend port**: Parse `appsettings.Local.json` -> `Kestrel.Endpoints.Http.Url` -> extract port from URL (e.g., `http://localhost:5290` -> `5290`)
|
|
130
|
-
- **Local frontend port**: Parse `.env.standalone` -> look for port in `VITE_API_URL`, or parse `package.json` -> `scripts.local` for `--port` flag
|
|
131
|
-
- **Dev backend port**: Default `5142`
|
|
132
|
-
- **Dev frontend port**: Default `6173`
|
|
66
|
+
**If injected cache = "no cache" OR --reset flag → CACHE_HIT=false, go to Step 1 (cold start).**
|
|
133
67
|
|
|
134
|
-
**
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
68
|
+
**If injected cache has JSON values AND no --reset:**
|
|
69
|
+
- Extract directly from injected cache: api_dir, web_dir, api_port, web_port, backend_cmd, frontend_cmd, connection_string, sql_server, sql_database
|
|
70
|
+
- CACHE_HIT=true
|
|
71
|
+
- **Skip directly to Step 4 (check ports)**
|
|
138
72
|
|
|
139
|
-
|
|
73
|
+
---
|
|
140
74
|
|
|
141
|
-
|
|
75
|
+
## Step 1: Detect project (Cold Start Only)
|
|
142
76
|
|
|
143
|
-
**
|
|
77
|
+
**Only if CACHE_HIT=false.**
|
|
144
78
|
|
|
145
|
-
|
|
79
|
+
Single message with 3 PARALLEL tool calls:
|
|
146
80
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
81
|
+
1. **Read** `src/SmartStack.Api/appsettings.json` (limit: 40 lines — connection string, CORS, FrontendUrl)
|
|
82
|
+
2. **Read** `src/SmartStack.Api/Properties/launchSettings.json`
|
|
83
|
+
3. **Bash** — detect mode + frontend env + SQL check:
|
|
84
|
+
```bash
|
|
85
|
+
echo "=== MODE ==="
|
|
86
|
+
[ -f src/SmartStack.Api/appsettings.Local.json ] && echo "Local" || echo "Development"
|
|
87
|
+
echo "=== ENV ==="
|
|
88
|
+
cat web/smartstack-web/.env.development 2>/dev/null || cat web/smartstack-web/.env.standalone 2>/dev/null || echo "NONE"
|
|
89
|
+
echo "=== SQL ==="
|
|
90
|
+
CS=$(sed -n 's/.*"DefaultConnection":\s*"\([^"]*\)".*/\1/p' src/SmartStack.Api/appsettings.json 2>/dev/null)
|
|
91
|
+
SN=$(echo "$CS" | sed -n 's/.*[Ss]erver=\([^;]*\).*/\1/p' | sed 's/(local)/./')
|
|
92
|
+
DB=$(echo "$CS" | sed -n 's/.*[Dd]atabase=\([^;]*\).*/\1/p')
|
|
93
|
+
sqlcmd -S "$SN" -Q "SET NOCOUNT ON;SELECT name FROM sys.databases WHERE name='$DB'" -t 5 -E -C -h -1 -W 2>/dev/null | grep -q "$DB" && echo "ok $SN $DB" || echo "warn $SN $DB"
|
|
94
|
+
```
|
|
153
95
|
|
|
154
|
-
|
|
96
|
+
Determine config from results:
|
|
155
97
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
7. If `.env.standalone` exists but NOT `appsettings.Local.json` -> **warn** (config incomplete)
|
|
98
|
+
| | Development (no Local config) | Local (appsettings.Local.json exists) |
|
|
99
|
+
|--|-------------------------------|--------------------------------------|
|
|
100
|
+
| api_port | 5142 (launchSettings "http") | Port from launchSettings "Local" |
|
|
101
|
+
| web_port | 6173 | From .env.standalone or 5305 |
|
|
102
|
+
| backend_cmd | `dotnet run --launch-profile http` | `dotnet run --launch-profile Local` |
|
|
103
|
+
| frontend_cmd | `npm run dev` | `npm run local` |
|
|
163
104
|
|
|
164
|
-
|
|
105
|
+
## Step 2: Validate config coherence (Cold Start Only)
|
|
165
106
|
|
|
166
|
-
|
|
167
|
-
2. Verify `appsettings.json` -> `SmartStack:CorsOrigins` contains `http://localhost:6173`
|
|
168
|
-
3. Verify `Authentication:FrontendUrl` = `http://localhost:6173`
|
|
107
|
+
**Only if CACHE_HIT=false.**
|
|
169
108
|
|
|
170
|
-
|
|
109
|
+
Display one line per check, continue even on warnings:
|
|
110
|
+
- VITE_API_URL port matches api_port → `[OK]` or `[WARN] expected X, got Y`
|
|
111
|
+
- CorsOrigins includes `http://localhost:{web_port}` → `[OK]` or `[WARN]`
|
|
112
|
+
- Authentication:FrontendUrl = `http://localhost:{web_port}` → `[OK]` or `[WARN]`
|
|
113
|
+
- SQL status → `[OK] {server}/{db}` or `[WARN] SQL unreachable`
|
|
171
114
|
|
|
172
|
-
|
|
173
|
-
2. Propose to auto-correct (write the correct files)
|
|
174
|
-
3. If user refuses, continue with a warning
|
|
115
|
+
## Step 3: Write cache (Cold Start Only)
|
|
175
116
|
|
|
176
|
-
|
|
117
|
+
**Only if CACHE_HIT=false.**
|
|
177
118
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
[OK] Local config files paired
|
|
184
|
-
|
|
185
|
-
-- OR --
|
|
186
|
-
|
|
187
|
-
[WARN] VITE_API_URL=http://localhost:5290 but backend runs on port 5142
|
|
188
|
-
Expected: VITE_API_URL=http://localhost:5142
|
|
189
|
-
[WARN] .env.standalone missing (appsettings.Local.json exists)
|
|
190
|
-
-> Creating .env.standalone with correct values...
|
|
119
|
+
Use Bash to write (avoids Write tool read-first requirement):
|
|
120
|
+
```bash
|
|
121
|
+
mkdir -p .claude/config && cat > .claude/config/dev-run.json << 'EOF'
|
|
122
|
+
{"version":2,"api_dir":"{api_dir}","web_dir":"{web_dir}","mode":"{mode}","api_port":{api_port},"web_port":{web_port},"backend_cmd":"{backend_cmd}","frontend_cmd":"{frontend_cmd}","connection_string":"{conn_str}","sql_server":"{srv}","sql_database":"{db}","sql_status":"{status}","cached_at":"{ISO now}"}
|
|
123
|
+
EOF
|
|
191
124
|
```
|
|
192
125
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
1. Extract connection string from appsettings:
|
|
196
|
-
- **Local mode**: `appsettings.Local.json` → `ConnectionStrings.DefaultConnection`
|
|
197
|
-
- **Dev mode**: `appsettings.json` → `ConnectionStrings.DefaultConnection`
|
|
198
|
-
|
|
199
|
-
2. Parse server and database:
|
|
200
|
-
```bash
|
|
201
|
-
SQL_SERVER=$(echo "$CONN_STR" | grep -oiP '(?:Server|Data Source)=\K[^;]+')
|
|
202
|
-
SQL_DATABASE=$(echo "$CONN_STR" | grep -oiP '(?:Database|Initial Catalog)=\K[^;]+')
|
|
203
|
-
USE_WIN_AUTH=$(echo "$CONN_STR" | grep -qi 'Integrated Security=true\|Trusted_Connection=true' && echo "true" || echo "false")
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
3. Test connectivity (5s timeout):
|
|
207
|
-
```bash
|
|
208
|
-
# Normalize (local) → .
|
|
209
|
-
SQL_SERVER_NORM=$(echo "$SQL_SERVER" | sed 's/(local)/./')
|
|
210
|
-
|
|
211
|
-
if [ "$USE_WIN_AUTH" = "true" ]; then
|
|
212
|
-
sqlcmd -S "$SQL_SERVER_NORM" -d master -Q "SELECT 1" -t 5 -E -C -h -1 -W 2>/dev/null
|
|
213
|
-
else
|
|
214
|
-
SQL_USER=$(echo "$CONN_STR" | grep -oiP '(?:User Id|Uid)=\K[^;]+')
|
|
215
|
-
SQL_PASS=$(echo "$CONN_STR" | grep -oiP '(?:Password|Pwd)=\K[^;]+')
|
|
216
|
-
sqlcmd -S "$SQL_SERVER_NORM" -d master -Q "SELECT 1" -t 5 -U "$SQL_USER" -P "$SQL_PASS" -C -h -1 -W 2>/dev/null
|
|
217
|
-
fi
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
4. If reachable, check database exists:
|
|
221
|
-
```bash
|
|
222
|
-
sqlcmd -S "$SQL_SERVER_NORM" -Q "SET NOCOUNT ON; SELECT name FROM sys.databases WHERE name = '$SQL_DATABASE'" -t 5 -E -C -h -1 -W 2>/dev/null
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
5. Output format:
|
|
226
|
-
| Scenario | Output | Blocking? |
|
|
227
|
-
|----------|--------|-----------|
|
|
228
|
-
| Server OK + DB exists | `[OK] SQL Server (server) — Database 'db' exists` | No |
|
|
229
|
-
| Server OK + DB missing | `[WARN] Database 'db' not found (AutoMigrate will create it)` | No |
|
|
230
|
-
| Server unreachable | `[FAIL] SQL Server (server) unreachable — Is the service running?` | No |
|
|
231
|
-
| sqlcmd not installed | `[SKIP] sqlcmd not found — SQL check skipped` | No |
|
|
232
|
-
| No connection string | `[SKIP] No connection string — SQL check skipped` | No |
|
|
233
|
-
|
|
234
|
-
## Step 3b: Write cache
|
|
235
|
-
|
|
236
|
-
**Only execute if CACHE_HIT=false (Steps 1-3 were executed).**
|
|
237
|
-
|
|
238
|
-
1. Ensure directory exists: `mkdir -p .claude/config`
|
|
239
|
-
|
|
240
|
-
2. Compute config hash:
|
|
241
|
-
```bash
|
|
242
|
-
if [ "$MODE" = "Local" ]; then
|
|
243
|
-
CONFIG_HASH=$(stat -c %Y "$API_DIR/appsettings.Local.json" "$WEB_DIR/.env.standalone" "$API_DIR/Properties/launchSettings.json" 2>/dev/null | md5sum | cut -d' ' -f1)
|
|
244
|
-
else
|
|
245
|
-
CONFIG_HASH=$(stat -c %Y "$API_DIR/appsettings.json" "$WEB_DIR/.env.development" "$API_DIR/Properties/launchSettings.json" 2>/dev/null | md5sum | cut -d' ' -f1)
|
|
246
|
-
fi
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
3. Write `.claude/config/dev-run.json` using the Write tool with all detected values:
|
|
250
|
-
```json
|
|
251
|
-
{
|
|
252
|
-
"version": 2,
|
|
253
|
-
"api_dir": "{API_DIR}",
|
|
254
|
-
"web_dir": "{WEB_DIR}",
|
|
255
|
-
"mode": "{MODE}",
|
|
256
|
-
"api_port": {API_PORT},
|
|
257
|
-
"web_port": {WEB_PORT},
|
|
258
|
-
"backend_cmd": "{BACKEND_CMD}",
|
|
259
|
-
"frontend_cmd": "{FRONTEND_CMD}",
|
|
260
|
-
"connection_string": "{CONN_STR}",
|
|
261
|
-
"sql_server": "{SQL_SERVER}",
|
|
262
|
-
"sql_database": "{SQL_DATABASE}",
|
|
263
|
-
"sql_status": "{ok|unreachable|db_missing|skipped}",
|
|
264
|
-
"config_hash": "{CONFIG_HASH}",
|
|
265
|
-
"cached_at": "{ISO_TIMESTAMP}"
|
|
266
|
-
}
|
|
267
|
-
```
|
|
126
|
+
**IMPORTANT:** This Bash call can be parallelized with Step 5/6 launches in a single message.
|
|
268
127
|
|
|
269
128
|
## Step 4: Check if already running
|
|
270
129
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
```
|
|
130
|
+
Check the injected "Ports running" state to see what's already listening:
|
|
131
|
+
- Backend running = api_port appears in Ports
|
|
132
|
+
- Frontend running = web_port appears in Ports
|
|
275
133
|
|
|
276
134
|
If `--backend-only`: skip frontend checks.
|
|
277
135
|
If `--frontend-only`: skip backend checks.
|
|
278
136
|
|
|
279
|
-
|
|
137
|
+
**If both running → skip to Step 7.** ZERO tool calls needed.
|
|
280
138
|
|
|
281
|
-
|
|
139
|
+
## Step 5: Launch backend
|
|
282
140
|
|
|
283
|
-
If NOT already running and NOT `--frontend-only
|
|
141
|
+
If NOT already running and NOT `--frontend-only`:
|
|
284
142
|
|
|
285
143
|
```bash
|
|
286
|
-
|
|
287
|
-
cd {API_DIR} && dotnet run {LAUNCH_ARGS}
|
|
144
|
+
cd {api_dir} && {backend_cmd}
|
|
288
145
|
```
|
|
289
146
|
|
|
290
|
-
Use `Bash(run_in_background=true)
|
|
291
|
-
|
|
292
|
-
### Fail-fast crash detection
|
|
293
|
-
|
|
294
|
-
After launching, wait 5 seconds then check if the process crashed:
|
|
295
|
-
```bash
|
|
296
|
-
sleep 5
|
|
297
|
-
```
|
|
298
|
-
Then call `TaskOutput(task_id="{TASK_ID}", block=false)` to read the background output.
|
|
147
|
+
Use `Bash(run_in_background=true)`. Track: `BACKEND_LAUNCHED=true`.
|
|
299
148
|
|
|
300
|
-
**
|
|
301
|
-
1. Display the error output to the user
|
|
302
|
-
2. Display: `[FAIL] Backend crashed on startup. Fix the error above and retry /dev-start`
|
|
303
|
-
3. **STOP immediately. Do NOT attempt to diagnose, fix, rebuild, or retry.**
|
|
149
|
+
**Launch backend AND frontend in the SAME message as parallel Bash(run_in_background) calls.**
|
|
304
150
|
|
|
305
151
|
## Step 6: Launch frontend
|
|
306
152
|
|
|
307
153
|
If NOT already running and NOT `--backend-only`:
|
|
308
154
|
|
|
309
155
|
```bash
|
|
310
|
-
|
|
311
|
-
cd {WEB_DIR} && npm run {SCRIPT}
|
|
156
|
+
cd {web_dir} && {frontend_cmd}
|
|
312
157
|
```
|
|
313
158
|
|
|
314
|
-
Use `Bash(run_in_background=true)
|
|
159
|
+
Use `Bash(run_in_background=true)`.
|
|
160
|
+
|
|
161
|
+
**This MUST be in the same message as Step 5 (parallel launches).**
|
|
162
|
+
**If cold start, also include Step 3 (cache write) in the same message.**
|
|
315
163
|
|
|
316
164
|
## Step 7: Handle admin password
|
|
317
165
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
"environment": "Development"
|
|
355
|
-
}
|
|
356
|
-
```
|
|
357
|
-
e. Verify `.claude/dev-session.json` is in `.gitignore`. If not, warn the user (contains credentials).
|
|
166
|
+
Choose ONE path based on BACKEND_LAUNCHED and session state:
|
|
167
|
+
|
|
168
|
+
### Path A: Backend just launched (ALWAYS reset — session or not)
|
|
169
|
+
The backend may have re-seeded the database on startup, invalidating any cached password.
|
|
170
|
+
Single Bash — wait for API then reset:
|
|
171
|
+
```bash
|
|
172
|
+
echo "Waiting for backend..."
|
|
173
|
+
for i in $(seq 1 20); do
|
|
174
|
+
HTTP=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:{api_port}/scalar 2>/dev/null)
|
|
175
|
+
[ "$HTTP" = "200" ] || [ "$HTTP" = "302" ] && echo "API ready" && break
|
|
176
|
+
[ $i -eq 20 ] && echo "API timeout — continuing anyway"
|
|
177
|
+
sleep 2
|
|
178
|
+
done
|
|
179
|
+
RESULT=$(timeout 20 smartstack admin reset --connection '{connection_string}' --force --json 2>&1 | grep -E '^\{')
|
|
180
|
+
EMAIL=$(echo "$RESULT" | sed -n 's/.*"email":"\([^"]*\)".*/\1/p')
|
|
181
|
+
PASS=$(echo "$RESULT" | sed -n 's/.*"password":"\([^"]*\)".*/\1/p')
|
|
182
|
+
cat > .claude/dev-session.json << SESSEOF
|
|
183
|
+
{"admin_email":"$EMAIL","admin_password":"$PASS","last_reset":"$(date -Iseconds)","api_port":{api_port},"web_port":{web_port},"environment":"{mode}","status":"ready"}
|
|
184
|
+
SESSEOF
|
|
185
|
+
echo "CREDENTIALS: $EMAIL / $PASS"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Path B: Backend already running + no session (or --reset)
|
|
189
|
+
Single Bash — reset only (no wait needed):
|
|
190
|
+
```bash
|
|
191
|
+
RESULT=$(timeout 20 smartstack admin reset --connection '{connection_string}' --force --json 2>&1 | grep -E '^\{')
|
|
192
|
+
EMAIL=$(echo "$RESULT" | sed -n 's/.*"email":"\([^"]*\)".*/\1/p')
|
|
193
|
+
PASS=$(echo "$RESULT" | sed -n 's/.*"password":"\([^"]*\)".*/\1/p')
|
|
194
|
+
cat > .claude/dev-session.json << SESSEOF
|
|
195
|
+
{"admin_email":"$EMAIL","admin_password":"$PASS","last_reset":"$(date -Iseconds)","api_port":{api_port},"web_port":{web_port},"environment":"{mode}","status":"ready"}
|
|
196
|
+
SESSEOF
|
|
197
|
+
echo "CREDENTIALS: $EMAIL / $PASS"
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Path C: Everything running + session exists (no --reset)
|
|
201
|
+
ZERO tool calls. Use email + password from injected session directly.
|
|
358
202
|
|
|
359
203
|
## Step 8: Display connection info
|
|
360
204
|
|
|
@@ -362,18 +206,15 @@ Use `Bash(run_in_background=true)` so it runs in background.
|
|
|
362
206
|
================================================================
|
|
363
207
|
SMARTSTACK DEV ENVIRONMENT
|
|
364
208
|
================================================================
|
|
209
|
+
Backend: http://localhost:{api_port} [{RUNNING|LAUNCHED}]
|
|
210
|
+
Frontend: http://localhost:{web_port} [{RUNNING|LAUNCHED}]
|
|
211
|
+
Swagger: http://localhost:{api_port}/scalar
|
|
212
|
+
SQL Server: {sql_server}/{sql_database} [{OK|WARN}]
|
|
365
213
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
Swagger: http://localhost:{API_PORT}/scalar
|
|
369
|
-
SQL Server: {SQL_SERVER}/{SQL_DATABASE} [OK|WARN|FAIL|SKIP]
|
|
370
|
-
|
|
371
|
-
Email: local.admin@smartstack.local
|
|
372
|
-
Password: xxxxxxxxxxxxxx
|
|
214
|
+
Email: {email}
|
|
215
|
+
Password: {password}
|
|
373
216
|
|
|
374
|
-
|
|
375
|
-
Config: OK | WARNING (details)
|
|
376
|
-
Cache: HIT (from {cached_at}) | MISS (re-detected)
|
|
217
|
+
Mode: {Development|Local}
|
|
377
218
|
================================================================
|
|
378
219
|
```
|
|
379
220
|
|
|
@@ -381,27 +222,22 @@ Use `Bash(run_in_background=true)` so it runs in background.
|
|
|
381
222
|
|
|
382
223
|
<important_notes>
|
|
383
224
|
|
|
384
|
-
1. **
|
|
385
|
-
2. **
|
|
386
|
-
3. **
|
|
387
|
-
4. **
|
|
388
|
-
5. **
|
|
389
|
-
6. **
|
|
390
|
-
7. **
|
|
391
|
-
8. **
|
|
392
|
-
9. **Idempotent**
|
|
393
|
-
10. **dev-session.json contains secrets** - Must be in `.gitignore`.
|
|
394
|
-
11. **Cache** - Config detection is cached in `.claude/config/dev-run.json`. Cache is invalidated when config files change (mtime-based hash). Use `--reset` to force re-detection.
|
|
395
|
-
12. **SQL check is non-blocking** - A failed SQL check displays a warning but does not prevent launch. AutoMigrate may create the database on startup.
|
|
225
|
+
1. **Injected state IS source of truth** — Cache, session, and ports are already loaded above. NEVER re-read these files. This is the #1 speed optimization.
|
|
226
|
+
2. **NEVER debug or fix code** — If backend/frontend fails to start, display the error and STOP. No rebuilds, no NuGet restore, no diagnosis.
|
|
227
|
+
3. **Parallel launches** — Backend + frontend MUST be launched in the same message (parallel Bash background calls).
|
|
228
|
+
4. **Timeout = warn** — If API doesn't respond after 40s, warn user and show what you have.
|
|
229
|
+
5. **Admin reset needs --connection** — Single-quoted: `--connection '{conn_str}'`. Without it, CLI blocks on interactive picker.
|
|
230
|
+
6. **dev-session.json has secrets** — Must be in .gitignore.
|
|
231
|
+
7. **SQL check non-blocking** — Warnings don't prevent launch.
|
|
232
|
+
8. **Cold start writes cache** — So next run uses CACHED path (fast).
|
|
233
|
+
9. **Idempotent** — Running twice detects already-running processes via injected Ports.
|
|
396
234
|
|
|
397
235
|
</important_notes>
|
|
398
236
|
|
|
399
237
|
<success_criteria>
|
|
400
|
-
-
|
|
401
|
-
-
|
|
402
|
-
-
|
|
403
|
-
-
|
|
404
|
-
-
|
|
405
|
-
- Cache written on first run, reused on subsequent runs
|
|
406
|
-
- SQL Server connectivity reported
|
|
238
|
+
- Path C (all running + session): 0 tool calls — instant display
|
|
239
|
+
- Path A (cached, backend launched): 3 tool calls — launch + wait + reset ~25s
|
|
240
|
+
- Path B (running, no session): 1 tool call — reset only ~10s
|
|
241
|
+
- Cold start: 5 tool calls max — ~30s
|
|
242
|
+
- NEVER more than 5 tool calls total
|
|
407
243
|
</success_criteria>
|
|
@@ -94,6 +94,19 @@ Pattern: `{context}_v{version}_{sequence}_{Description}`
|
|
|
94
94
|
|
|
95
95
|
</shared>
|
|
96
96
|
|
|
97
|
+
<success_criteria>
|
|
98
|
+
- Command displays its summary block with no ERROR lines
|
|
99
|
+
- db-status: both contexts report migration counts (no connection failure)
|
|
100
|
+
- db-deploy: 0 pending migrations after execution
|
|
101
|
+
- db-reset: database recreated, all migrations applied for both contexts
|
|
102
|
+
- db-seed: seed method detected and executed, records inserted
|
|
103
|
+
- scan: all worktree branches analyzed with risk levels
|
|
104
|
+
- conflicts: EXIT CODE 0 (no HIGH/CRITICAL)
|
|
105
|
+
- migration: MCP-named migration created, compiles, applies cleanly
|
|
106
|
+
- squash: consolidated migration compiles and applies identically
|
|
107
|
+
- rebase-snapshot: ModelSnapshot aligned with parent branch
|
|
108
|
+
</success_criteria>
|
|
109
|
+
|
|
97
110
|
<command-db-status>
|
|
98
111
|
|
|
99
112
|
## db-status — Fast migration state check
|