myaidev-method 0.2.4 → 0.2.6

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 (55) hide show
  1. package/USER_GUIDE.md +389 -8
  2. package/bin/cli.js +165 -30
  3. package/package.json +1 -1
  4. package/src/lib/ascii-banner.js +100 -0
  5. package/src/templates/claude/commands/myai-deploy-dev.md +500 -0
  6. package/src/templates/claude/commands/myai-deploy-prod.md +837 -0
  7. package/src/templates/claude/commands/myai-deploy-staging.md +331 -0
  8. package/src/templates/claude/commands/myai-git-hotfix.md +957 -0
  9. package/src/templates/claude/commands/myai-git-pr.md +200 -0
  10. package/src/templates/claude/commands/myai-git-release.md +806 -0
  11. package/src/templates/claude/commands/myai-git-sync.md +796 -0
  12. package/src/templates/codex/commands/myai-astro-publish.md +51 -0
  13. package/src/templates/codex/commands/myai-configure.md +185 -0
  14. package/src/templates/codex/commands/myai-content-writer.md +73 -0
  15. package/src/templates/codex/commands/myai-coolify-deploy.md +159 -0
  16. package/src/templates/codex/commands/myai-deploy-dev.md +379 -0
  17. package/src/templates/codex/commands/myai-deploy-prod.md +431 -0
  18. package/src/templates/codex/commands/myai-deploy-staging.md +275 -0
  19. package/src/templates/codex/commands/myai-dev-architect.md +69 -0
  20. package/src/templates/codex/commands/myai-dev-code.md +82 -0
  21. package/src/templates/codex/commands/myai-dev-docs.md +83 -0
  22. package/src/templates/codex/commands/myai-dev-review.md +85 -0
  23. package/src/templates/codex/commands/myai-dev-test.md +84 -0
  24. package/src/templates/codex/commands/myai-docusaurus-publish.md +42 -0
  25. package/src/templates/codex/commands/myai-git-hotfix.md +512 -0
  26. package/src/templates/codex/commands/myai-git-pr.md +196 -0
  27. package/src/templates/codex/commands/myai-git-release.md +516 -0
  28. package/src/templates/codex/commands/myai-git-sync.md +517 -0
  29. package/src/templates/codex/commands/myai-mintlify-publish.md +42 -0
  30. package/src/templates/codex/commands/myai-payloadcms-publish.md +42 -0
  31. package/src/templates/codex/commands/myai-sparc-workflow.md +185 -0
  32. package/src/templates/codex/commands/myai-wordpress-admin.md +143 -0
  33. package/src/templates/codex/commands/myai-wordpress-publish.md +66 -0
  34. package/src/templates/gemini/commands/myai-astro-publish.toml +76 -0
  35. package/src/templates/gemini/commands/myai-configure.toml +188 -0
  36. package/src/templates/gemini/commands/myai-content-writer.toml +76 -0
  37. package/src/templates/gemini/commands/myai-coolify-deploy.toml +138 -0
  38. package/src/templates/gemini/commands/myai-deploy-dev.toml +379 -0
  39. package/src/templates/gemini/commands/myai-deploy-prod.toml +438 -0
  40. package/src/templates/gemini/commands/myai-deploy-staging.toml +275 -0
  41. package/src/templates/gemini/commands/myai-dev-architect.toml +64 -0
  42. package/src/templates/gemini/commands/myai-dev-code.toml +75 -0
  43. package/src/templates/gemini/commands/myai-dev-docs.toml +76 -0
  44. package/src/templates/gemini/commands/myai-dev-review.toml +78 -0
  45. package/src/templates/gemini/commands/myai-dev-test.toml +77 -0
  46. package/src/templates/gemini/commands/myai-docusaurus-publish.toml +63 -0
  47. package/src/templates/gemini/commands/myai-git-hotfix.toml +953 -0
  48. package/src/templates/gemini/commands/myai-git-pr.toml +196 -0
  49. package/src/templates/gemini/commands/myai-git-release.toml +802 -0
  50. package/src/templates/gemini/commands/myai-git-sync.toml +792 -0
  51. package/src/templates/gemini/commands/myai-mintlify-publish.toml +67 -0
  52. package/src/templates/gemini/commands/myai-payloadcms-publish.toml +59 -0
  53. package/src/templates/gemini/commands/myai-sparc-workflow.toml +47 -0
  54. package/src/templates/gemini/commands/myai-wordpress-admin.toml +143 -0
  55. package/src/templates/gemini/commands/myai-wordpress-publish.toml +77 -0
@@ -0,0 +1,379 @@
1
+ # Deploy to development environment via Coolify or Docker
2
+
3
+ You are a deployment automation assistant specializing in development environment deployments.
4
+
5
+ Task: Deploy to development environment - $ARGUMENTS
6
+
7
+ ## Development Deployment Workflow
8
+
9
+ ### 1. Pre-Deployment Checks
10
+
11
+ ```bash
12
+ # Check current branch and status
13
+ git branch --show-current
14
+ git status
15
+
16
+ # Ensure on dev branch
17
+ if [ "$(git branch --show-current)" != "dev" ] && [ "$(git branch --show-current)" != "develop" ]; then
18
+ echo "⚠️ Not on dev/develop branch. Switch first."
19
+ git checkout dev || git checkout develop
20
+ fi
21
+
22
+ # Pull latest changes
23
+ git pull origin $(git branch --show-current)
24
+
25
+ # Check for uncommitted changes (warning only, not blocking)
26
+ if ! git diff-index --quiet HEAD --; then
27
+ echo "⚠️ Uncommitted changes detected (non-blocking for dev)"
28
+ git status
29
+ fi
30
+ ```
31
+
32
+ ### 2. Environment Validation
33
+
34
+ **Check Required Environment Variables:**
35
+ ```bash
36
+ # For Coolify
37
+ required_vars=("COOLIFY_URL" "COOLIFY_API_TOKEN" "COOLIFY_DEV_APP_ID")
38
+
39
+ # For Docker
40
+ docker_vars=("DOCKER_REGISTRY" "DEV_IMAGE_TAG")
41
+
42
+ # Check Coolify vars
43
+ missing_vars=()
44
+ for var in "${required_vars[@]}"; do
45
+ if [ -z "${!var}" ]; then
46
+ missing_vars+=("$var")
47
+ fi
48
+ done
49
+
50
+ # If Coolify vars missing, check Docker vars
51
+ if [ ${#missing_vars[@]} -gt 0 ]; then
52
+ echo "⚠️ Coolify variables not set, checking Docker..."
53
+ for var in "${docker_vars[@]}"; do
54
+ if [ -z "${!var}" ]; then
55
+ echo "❌ Missing required variable: $var"
56
+ exit 1
57
+ fi
58
+ done
59
+ fi
60
+ ```
61
+
62
+ ### 3. Quick Build and Test
63
+
64
+ ```bash
65
+ # Run minimal tests for faster deployment
66
+ echo "🧪 Running quick test suite..."
67
+ npm run test:unit || echo "⚠️ Unit tests failed (non-blocking for dev)"
68
+
69
+ # Build application
70
+ echo "🏗️ Building application..."
71
+ npm run build || { echo "❌ Build failed"; exit 1; }
72
+
73
+ # Skip linter for dev (optional)
74
+ # npm run lint || echo "⚠️ Linting issues detected"
75
+ ```
76
+
77
+ ### 4. Deployment Options
78
+
79
+ #### Option A: Deploy with Coolify
80
+
81
+ ```bash
82
+ # Using Coolify API
83
+ echo "🚀 Deploying to Coolify dev environment..."
84
+
85
+ # Trigger deployment
86
+ response=$(curl -s -w "\n%{http_code}" -X POST "$COOLIFY_URL/api/v1/deploy" \
87
+ -H "Authorization: Bearer $COOLIFY_API_TOKEN" \
88
+ -H "Content-Type: application/json" \
89
+ -d "{
90
+ \"application_id\": \"$COOLIFY_DEV_APP_ID\",
91
+ \"force\": true,
92
+ \"commit\": \"$(git rev-parse HEAD)\"
93
+ }")
94
+
95
+ http_code=$(echo "$response" | tail -1)
96
+ body=$(echo "$response" | head -n -1)
97
+
98
+ if [ "$http_code" -ne 200 ] && [ "$http_code" -ne 201 ]; then
99
+ echo "❌ Deployment trigger failed with status $http_code"
100
+ echo "$body"
101
+ exit 1
102
+ fi
103
+
104
+ echo "✅ Deployment triggered successfully!"
105
+
106
+ # Quick status check (don't wait for completion)
107
+ echo "📊 Deployment initiated. Check Coolify dashboard for progress."
108
+ echo "🌐 Dashboard: $COOLIFY_URL/applications/$COOLIFY_DEV_APP_ID"
109
+ ```
110
+
111
+ #### Option B: Deploy with Docker
112
+
113
+ ```bash
114
+ echo "🐳 Deploying with Docker..."
115
+
116
+ # Build Docker image with dev tag
117
+ docker build -t $DOCKER_REGISTRY/app:dev -f Dockerfile.dev .
118
+
119
+ # Push to registry
120
+ docker push $DOCKER_REGISTRY/app:dev
121
+
122
+ # Deploy to dev server via SSH
123
+ ssh dev-server << 'EOF'
124
+ # Pull latest image
125
+ docker pull $DOCKER_REGISTRY/app:dev
126
+
127
+ # Stop and remove old container
128
+ docker stop app-dev 2>/dev/null || true
129
+ docker rm app-dev 2>/dev/null || true
130
+
131
+ # Run new container
132
+ docker run -d \
133
+ --name app-dev \
134
+ --restart unless-stopped \
135
+ -p 3000:3000 \
136
+ --env-file /etc/app/dev.env \
137
+ -e NODE_ENV=development \
138
+ $DOCKER_REGISTRY/app:dev
139
+
140
+ # Show container status
141
+ docker ps | grep app-dev
142
+ EOF
143
+
144
+ echo "✅ Docker deployment complete!"
145
+ ```
146
+
147
+ #### Option C: Deploy with Docker Compose
148
+
149
+ ```bash
150
+ echo "🐳 Deploying with Docker Compose..."
151
+
152
+ # Deploy to dev server
153
+ ssh dev-server << 'EOF'
154
+ cd /opt/app
155
+ git pull origin dev
156
+ docker-compose -f docker-compose.dev.yml pull
157
+ docker-compose -f docker-compose.dev.yml up -d --remove-orphans --force-recreate
158
+ docker-compose -f docker-compose.dev.yml ps
159
+ EOF
160
+
161
+ echo "✅ Docker Compose deployment complete!"
162
+ ```
163
+
164
+ #### Option D: Hot Reload Development (Watch Mode)
165
+
166
+ ```bash
167
+ echo "🔥 Setting up hot-reload development deployment..."
168
+
169
+ # Sync code to dev server with watch
170
+ rsync -avz --delete \
171
+ --exclude 'node_modules' \
172
+ --exclude '.git' \
173
+ --exclude 'dist' \
174
+ ./ dev-server:/opt/app/
175
+
176
+ # Start development server with hot reload
177
+ ssh dev-server << 'EOF'
178
+ cd /opt/app
179
+ npm install
180
+ pm2 restart app-dev || pm2 start npm --name app-dev -- run dev
181
+ pm2 logs app-dev --lines 20
182
+ EOF
183
+
184
+ echo "✅ Hot-reload deployment active!"
185
+ echo "💡 Changes will auto-reload on the dev server"
186
+ ```
187
+
188
+ ### 5. Post-Deployment Verification
189
+
190
+ ```bash
191
+ echo "🔍 Verifying deployment..."
192
+
193
+ # Quick health check (shorter timeout for dev)
194
+ max_retries=10
195
+ retry_count=0
196
+
197
+ while [ $retry_count -lt $max_retries ]; do
198
+ if curl -f -s "$DEV_URL/health" > /dev/null 2>&1; then
199
+ echo "✅ Health check passed!"
200
+ break
201
+ else
202
+ echo "⏳ Waiting for application... ($retry_count/$max_retries)"
203
+ sleep 3
204
+ ((retry_count++))
205
+ fi
206
+ done
207
+
208
+ if [ $retry_count -eq $max_retries ]; then
209
+ echo "⚠️ Health check timeout (non-critical for dev)"
210
+ echo "Check logs: $COOLIFY_URL/applications/$COOLIFY_DEV_APP_ID/logs"
211
+ fi
212
+
213
+ # Quick smoke test
214
+ echo "🧪 Running quick smoke test..."
215
+ response=$(curl -s -o /dev/null -w "%{http_code}" "$DEV_URL/")
216
+ if [ "$response" -eq 200 ]; then
217
+ echo "✅ Application responding correctly"
218
+ else
219
+ echo "⚠️ Application returned status: $response"
220
+ fi
221
+
222
+ # Show recent logs
223
+ echo "📋 Recent logs:"
224
+ if [ -n "$COOLIFY_URL" ]; then
225
+ curl -s "$COOLIFY_URL/api/v1/applications/$COOLIFY_DEV_APP_ID/logs" \
226
+ -H "Authorization: Bearer $COOLIFY_API_TOKEN" | tail -20
227
+ else
228
+ ssh dev-server "docker logs --tail 20 app-dev" || \
229
+ ssh dev-server "pm2 logs app-dev --lines 20 --nostream"
230
+ fi
231
+ ```
232
+
233
+ ### 6. Rollback Procedure
234
+
235
+ ```bash
236
+ rollback_dev() {
237
+ echo "🔄 Rolling back dev deployment..."
238
+
239
+ # Get previous commit
240
+ previous_commit=$(git log --oneline -2 | tail -1 | cut -d' ' -f1)
241
+ echo "Rolling back to: $previous_commit"
242
+
243
+ # Rollback via Coolify
244
+ if [ -n "$COOLIFY_URL" ]; then
245
+ curl -X POST "$COOLIFY_URL/api/v1/deploy" \
246
+ -H "Authorization: Bearer $COOLIFY_API_TOKEN" \
247
+ -H "Content-Type: application/json" \
248
+ -d "{
249
+ \"application_id\": \"$COOLIFY_DEV_APP_ID\",
250
+ \"commit\": \"$previous_commit\",
251
+ \"force\": true
252
+ }"
253
+ fi
254
+
255
+ # Or rollback via Docker
256
+ if [ -n "$DOCKER_REGISTRY" ]; then
257
+ ssh dev-server << EOF
258
+ docker pull $DOCKER_REGISTRY/app:dev-previous
259
+ docker stop app-dev
260
+ docker rm app-dev
261
+ docker run -d \
262
+ --name app-dev \
263
+ --restart unless-stopped \
264
+ -p 3000:3000 \
265
+ $DOCKER_REGISTRY/app:dev-previous
266
+ EOF
267
+ fi
268
+
269
+ # Or rollback via git
270
+ if [ -n "$DEV_SERVER_PATH" ]; then
271
+ ssh dev-server << EOF
272
+ cd /opt/app
273
+ git checkout $previous_commit
274
+ npm install
275
+ npm run build
276
+ pm2 restart app-dev
277
+ EOF
278
+ fi
279
+
280
+ echo "✅ Rollback complete!"
281
+ }
282
+
283
+ # Call rollback if needed
284
+ # rollback_dev
285
+ ```
286
+
287
+ ## Complete Deployment Script
288
+
289
+ ```bash
290
+ #!/bin/bash
291
+ set -e
292
+
293
+ echo "🚀 Starting dev deployment..."
294
+
295
+ # 1. Quick pre-flight checks
296
+ current_branch=$(git branch --show-current)
297
+ if [[ "$current_branch" != "dev" && "$current_branch" != "develop" ]]; then
298
+ echo "⚠️ Not on dev branch, switching..."
299
+ git checkout dev || git checkout develop
300
+ fi
301
+
302
+ git pull origin $(git branch --show-current)
303
+
304
+ # 2. Build (tests optional for dev)
305
+ echo "🏗️ Building..."
306
+ npm run build || { echo "❌ Build failed"; exit 1; }
307
+
308
+ # 3. Deploy (choose method)
309
+ if [ -n "$COOLIFY_DEV_APP_ID" ]; then
310
+ # Coolify method
311
+ echo "🚀 Deploying via Coolify..."
312
+ curl -X POST "$COOLIFY_URL/api/v1/deploy" \
313
+ -H "Authorization: Bearer $COOLIFY_API_TOKEN" \
314
+ -H "Content-Type: application/json" \
315
+ -d "{\"application_id\":\"$COOLIFY_DEV_APP_ID\",\"commit\":\"$(git rev-parse HEAD)\",\"force\":true}"
316
+ elif [ -n "$DOCKER_REGISTRY" ]; then
317
+ # Docker method
318
+ echo "🐳 Deploying via Docker..."
319
+ docker build -t $DOCKER_REGISTRY/app:dev .
320
+ docker push $DOCKER_REGISTRY/app:dev
321
+ ssh dev-server "docker pull $DOCKER_REGISTRY/app:dev && docker stop app-dev; docker rm app-dev; docker run -d --name app-dev -p 3000:3000 $DOCKER_REGISTRY/app:dev"
322
+ else
323
+ echo "❌ No deployment method configured"
324
+ exit 1
325
+ fi
326
+
327
+ # 4. Quick verify
328
+ sleep 5
329
+ curl -f "$DEV_URL/health" || echo "⚠️ Health check failed (non-critical)"
330
+
331
+ echo "✅ Dev deployment complete!"
332
+ echo "🌐 Application: $DEV_URL"
333
+ ```
334
+
335
+ ## Environment Configuration
336
+
337
+ **Required .env variables:**
338
+ ```bash
339
+ # Coolify
340
+ COOLIFY_URL=https://coolify.your-server.com
341
+ COOLIFY_API_TOKEN=your_api_token
342
+ COOLIFY_DEV_APP_ID=your_dev_app_id
343
+
344
+ # Docker (alternative)
345
+ DOCKER_REGISTRY=registry.your-domain.com
346
+ DEV_IMAGE_TAG=dev
347
+
348
+ # Application
349
+ DEV_URL=https://dev.your-app.com
350
+
351
+ # Server (optional for direct deployment)
352
+ DEV_SERVER=dev-server.your-domain.com
353
+ DEV_SERVER_PATH=/opt/app
354
+
355
+ # Notifications (optional)
356
+ SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
357
+ DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/YOUR/WEBHOOK
358
+ ```
359
+
360
+ ## Development Tips
361
+
362
+ **Fast iteration workflow:**
363
+ ```bash
364
+ # Watch mode with auto-deploy
365
+ npm run dev -- --watch
366
+
367
+ # Or use rsync for live sync
368
+ while inotifywait -r -e modify,create,delete src/; do
369
+ rsync -avz src/ dev-server:/opt/app/src/
370
+ done
371
+ ```
372
+
373
+ **Skip tests for rapid deployment:**
374
+ ```bash
375
+ export SKIP_TESTS=true
376
+ /myai-deploy-dev --quick
377
+ ```
378
+
379
+ Execute the dev deployment workflow with minimal checks for fast iteration.