workflow-agent-cli 1.1.2

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.
@@ -0,0 +1,509 @@
1
+ # Deployment Strategy
2
+
3
+ > **Purpose**: This document defines the deployment workflow, environment management, database migration strategy, and rollback procedures for ProjectHub.
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ 1. [Deployment Overview](#deployment-overview)
10
+ 2. [Environments](#environments)
11
+ 3. [Environment Variables](#environment-variables)
12
+ 4. [Deployment Workflow](#deployment-workflow)
13
+ 5. [Database Migrations](#database-migrations)
14
+ 6. [Preview Deployments](#preview-deployments)
15
+ 7. [Production Deployment](#production-deployment)
16
+ 8. [Rollback Procedures](#rollback-procedures)
17
+ 9. [Monitoring](#monitoring)
18
+
19
+ ---
20
+
21
+ ## Deployment Overview
22
+
23
+ ProjectHub uses **Vercel** for deployment with the following architecture:
24
+
25
+ ```
26
+ ┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
27
+ │ Git Push │────▶│ Vercel Build │────▶│ Deployment │
28
+ │ (GitHub) │ │ (Next.js) │ │ (Edge Network) │
29
+ └─────────────────┘ └──────────────────┘ └─────────────────┘
30
+
31
+
32
+ ┌─────────────────┐
33
+ │ Supabase │
34
+ │ (PostgreSQL) │
35
+ └─────────────────┘
36
+ ```
37
+
38
+ ### Key Components
39
+
40
+ | Component | Platform | Purpose |
41
+ | -------------- | ------------- | ------------------------------------------- |
42
+ | Frontend + API | Vercel | Next.js app, server actions, edge functions |
43
+ | Database | Supabase | PostgreSQL, RLS, real-time subscriptions |
44
+ | Auth | Supabase Auth | Session management, OAuth providers |
45
+ | CDN | Vercel Edge | Static assets, caching |
46
+
47
+ ---
48
+
49
+ ## Environments
50
+
51
+ ### Environment Types
52
+
53
+ | Environment | Branch | Purpose | URL Pattern |
54
+ | ----------- | ---------------- | -------------------- | ------------------------------ |
55
+ | Production | `main` | Live application | `projecthub.vercel.app` |
56
+ | Preview | Feature branches | PR previews, testing | `projecthub-<hash>.vercel.app` |
57
+ | Local | N/A | Development | `localhost:3000` |
58
+
59
+ ### Supabase Projects
60
+
61
+ | Environment | Supabase Project | Purpose |
62
+ | ----------- | -------------------- | ---------------------- |
63
+ | Production | `projecthub-prod` | Live data |
64
+ | Staging | `projecthub-staging` | Pre-production testing |
65
+ | Local | Local Docker | Development |
66
+
67
+ ---
68
+
69
+ ## Environment Variables
70
+
71
+ ### Required Variables
72
+
73
+ | Variable | Description | Source |
74
+ | ------------------------------- | ------------------------ | ----------------------------------- |
75
+ | `NEXT_PUBLIC_SUPABASE_URL` | Supabase project URL | Supabase Dashboard → Settings → API |
76
+ | `NEXT_PUBLIC_SUPABASE_ANON_KEY` | Supabase public anon key | Supabase Dashboard → Settings → API |
77
+
78
+ ### Optional Variables
79
+
80
+ | Variable | Description | Default |
81
+ | --------------------------- | ------------------------------ | ------------------------- |
82
+ | `NEXT_PUBLIC_APP_URL` | Application URL | Auto-detected by Vercel |
83
+ | `SUPABASE_SERVICE_ROLE_KEY` | Server-side Supabase admin key | Only for admin operations |
84
+
85
+ ### Secret Management
86
+
87
+ 1. **Never commit secrets** to the repository
88
+ 2. **Use Vercel environment variables** for all secrets
89
+ 3. **Scope secrets by environment**:
90
+ - Production: Only production values
91
+ - Preview: Staging or development values
92
+ - Development: Local `.env.local` file
93
+
94
+ ### Setting Environment Variables
95
+
96
+ ```bash
97
+ # Via Vercel CLI
98
+ vercel env add NEXT_PUBLIC_SUPABASE_URL production
99
+ vercel env add NEXT_PUBLIC_SUPABASE_URL preview
100
+
101
+ # Or via Vercel Dashboard
102
+ # Project → Settings → Environment Variables
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Deployment Workflow
108
+
109
+ ### Standard Flow (Feature Branch)
110
+
111
+ ```
112
+ 1. Developer creates branch
113
+ └── feature/tasks/add-reminder
114
+
115
+ 2. Developer pushes changes
116
+ └── git push origin feature/tasks/add-reminder
117
+
118
+ 3. Vercel creates preview deployment
119
+ └── https://projecthub-abc123.vercel.app
120
+
121
+ 4. Developer creates PR
122
+ └── Title: feat(tasks): add reminder functionality
123
+
124
+ 5. Automated checks run
125
+ ├── Vercel build (Next.js compile)
126
+ ├── GitHub Actions (if configured)
127
+ └── Preview URL available
128
+
129
+ 6. Review and approval
130
+ └── Code review, manual testing on preview
131
+
132
+ 7. Merge to main
133
+ └── Squash and merge
134
+
135
+ 8. Production deployment
136
+ └── Automatic on merge to main
137
+ ```
138
+
139
+ ### Deployment Triggers
140
+
141
+ | Trigger | Environment | Automatic |
142
+ | ---------------------- | ----------- | ------------ |
143
+ | Push to feature branch | Preview | ✅ Yes |
144
+ | PR created/updated | Preview | ✅ Yes |
145
+ | Merge to `main` | Production | ✅ Yes |
146
+ | Manual via CLI | Any | ✅ On-demand |
147
+
148
+ ---
149
+
150
+ ## Database Migrations
151
+
152
+ ### Migration File Location
153
+
154
+ ```
155
+ supabase/
156
+ └── migrations/
157
+ ├── 001_initial_schema.sql
158
+ ├── 002_add_sprints.sql
159
+ └── 003_add_notifications.sql
160
+ ```
161
+
162
+ ### Creating Migrations
163
+
164
+ ```bash
165
+ # Create new migration file
166
+ touch supabase/migrations/$(date +%Y%m%d%H%M%S)_description.sql
167
+
168
+ # Or using Supabase CLI
169
+ supabase migration new add_feature_table
170
+ ```
171
+
172
+ ### Migration File Format
173
+
174
+ ```sql
175
+ -- supabase/migrations/20260108120000_add_due_date_reminders.sql
176
+
177
+ -- Description: Add due date reminder functionality
178
+ -- Author: Developer Name
179
+ -- Date: 2026-01-08
180
+
181
+ -- Up Migration
182
+ CREATE TABLE IF NOT EXISTS task_reminders (
183
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
184
+ task_id UUID REFERENCES tasks(id) ON DELETE CASCADE,
185
+ remind_at TIMESTAMPTZ NOT NULL,
186
+ created_at TIMESTAMPTZ DEFAULT NOW()
187
+ );
188
+
189
+ -- Enable RLS
190
+ ALTER TABLE task_reminders ENABLE ROW LEVEL SECURITY;
191
+
192
+ -- RLS Policies
193
+ CREATE POLICY "Users can manage their task reminders"
194
+ ON task_reminders
195
+ FOR ALL
196
+ USING (
197
+ task_id IN (
198
+ SELECT id FROM tasks WHERE assignee = auth.uid()
199
+ )
200
+ );
201
+
202
+ -- ============================================
203
+ -- ROLLBACK SQL (Keep at bottom of file)
204
+ -- ============================================
205
+ -- DROP POLICY IF EXISTS "Users can manage their task reminders" ON task_reminders;
206
+ -- DROP TABLE IF EXISTS task_reminders;
207
+ ```
208
+
209
+ ### Running Migrations
210
+
211
+ #### Local Development
212
+
213
+ ```bash
214
+ # Start local Supabase
215
+ supabase start
216
+
217
+ # Run pending migrations
218
+ supabase db push
219
+
220
+ # Reset database (warning: destroys data)
221
+ supabase db reset
222
+ ```
223
+
224
+ #### Staging/Production
225
+
226
+ ```bash
227
+ # Link to Supabase project
228
+ supabase link --project-ref your-project-ref
229
+
230
+ # Push migrations to remote
231
+ supabase db push
232
+
233
+ # Or run manually in SQL Editor (Supabase Dashboard)
234
+ ```
235
+
236
+ ### Migration Checklist
237
+
238
+ Before deploying a migration:
239
+
240
+ - [ ] **Test locally** with `supabase db push`
241
+ - [ ] **Include rollback SQL** in migration file
242
+ - [ ] **Update types** - regenerate `types/supabase.ts`
243
+ - [ ] **Check RLS policies** - ensure security
244
+ - [ ] **Test with sample data** - verify queries work
245
+ - [ ] **Document breaking changes** - if any
246
+
247
+ ### Dual-Database Migration (REQUIRED)
248
+
249
+ > **⚠️ MANDATORY**: All migrations MUST be run on both dev and prod databases.
250
+
251
+ **Preferred Method (Automated):**
252
+
253
+ ```bash
254
+ # Runs dev first, then prod (stops on dev failure)
255
+ ./scripts/db.sh migrate-both
256
+ ```
257
+
258
+ **Manual Method (Step-by-Step):**
259
+
260
+ ```bash
261
+ # Step 1: Run on DEV
262
+ ./scripts/db.sh link dev
263
+ ./scripts/db.sh migrate
264
+ ./scripts/db.sh status # ✓ Verify migration applied
265
+
266
+ # Step 2: Run on PROD (only if dev succeeded)
267
+ ./scripts/db.sh link prod
268
+ ./scripts/db.sh migrate
269
+ ./scripts/db.sh status # ✓ Verify migration applied
270
+ ```
271
+
272
+ **Migration Execution Checklist:**
273
+
274
+ - [ ] DEV migration executed successfully
275
+ - [ ] DEV migration status verified (`./scripts/db.sh status`)
276
+ - [ ] PROD migration executed successfully
277
+ - [ ] PROD migration status verified (`./scripts/db.sh status`)
278
+
279
+ ---
280
+
281
+ ## Preview Deployments
282
+
283
+ ### Automatic Preview URLs
284
+
285
+ Every PR gets an automatic preview deployment:
286
+
287
+ ```
288
+ https://projecthub-<hash>-<team>.vercel.app
289
+ ```
290
+
291
+ ### Preview Environment Configuration
292
+
293
+ Preview deployments use:
294
+
295
+ - **Preview environment variables** (from Vercel)
296
+ - **Staging Supabase project** (recommended) OR
297
+ - **Production Supabase** with read-only access
298
+
299
+ ### Testing on Preview
300
+
301
+ 1. Click preview URL in PR
302
+ 2. Test the specific feature
303
+ 3. Verify no regressions
304
+ 4. Check mobile responsiveness
305
+ 5. Test authentication flow
306
+
307
+ ### Preview Deployment Limitations
308
+
309
+ - Preview deployments expire after inactivity
310
+ - Database changes require separate staging environment
311
+ - Real-time features may behave differently
312
+
313
+ ---
314
+
315
+ ## Production Deployment
316
+
317
+ ### Pre-Deployment Checklist
318
+
319
+ Before merging to `main`:
320
+
321
+ - [ ] All tests pass (`pnpm test`)
322
+ - [ ] TypeScript compiles (`pnpm typecheck`)
323
+ - [ ] Linting passes (`pnpm lint`)
324
+ - [ ] PR approved by required reviewers
325
+ - [ ] Preview deployment tested
326
+ - [ ] Database migrations tested (if any)
327
+ - [ ] Environment variables set in Vercel
328
+ - [ ] No breaking changes (or documented)
329
+
330
+ ### Deployment Process
331
+
332
+ ```bash
333
+ # Automatic: Just merge PR to main
334
+ # Vercel automatically deploys on merge
335
+
336
+ # Manual: Using Vercel CLI
337
+ vercel --prod
338
+
339
+ # Manual: Using GitHub
340
+ # 1. Go to Actions tab
341
+ # 2. Run "Deploy to Production" workflow
342
+ ```
343
+
344
+ ### Post-Deployment Verification
345
+
346
+ After deployment:
347
+
348
+ - [ ] Verify production URL is accessible
349
+ - [ ] Test critical paths (login, create task, etc.)
350
+ - [ ] Check Vercel function logs for errors
351
+ - [ ] Monitor Supabase dashboard for issues
352
+ - [ ] Verify real-time subscriptions work
353
+
354
+ ---
355
+
356
+ ## Rollback Procedures
357
+
358
+ ### When to Rollback
359
+
360
+ - Critical bug affecting all users
361
+ - Security vulnerability discovered
362
+ - Database corruption
363
+ - Performance degradation
364
+
365
+ ### Application Rollback (Vercel)
366
+
367
+ #### Via Dashboard
368
+
369
+ 1. Go to Vercel Dashboard → Project → Deployments
370
+ 2. Find the last working deployment
371
+ 3. Click "..." menu → "Promote to Production"
372
+
373
+ #### Via CLI
374
+
375
+ ```bash
376
+ # List recent deployments
377
+ vercel ls
378
+
379
+ # Rollback to specific deployment
380
+ vercel rollback <deployment-url>
381
+ ```
382
+
383
+ ### Database Rollback
384
+
385
+ #### If Migration Included Rollback SQL
386
+
387
+ ```sql
388
+ -- Run the rollback SQL from the migration file
389
+ -- Usually commented at the bottom
390
+
391
+ DROP POLICY IF EXISTS "Users can manage their task reminders" ON task_reminders;
392
+ DROP TABLE IF EXISTS task_reminders;
393
+ ```
394
+
395
+ #### If No Rollback SQL (Emergency)
396
+
397
+ 1. **Restore from backup** (Supabase Dashboard → Settings → Backups)
398
+ 2. Or **manually reverse changes** using SQL Editor
399
+
400
+ ### Rollback Checklist
401
+
402
+ - [ ] Identify the issue and scope
403
+ - [ ] Notify team of rollback
404
+ - [ ] Execute rollback (app and/or database)
405
+ - [ ] Verify rollback successful
406
+ - [ ] Document what went wrong
407
+ - [ ] Create fix and re-deploy
408
+
409
+ ---
410
+
411
+ ## Monitoring
412
+
413
+ ### Vercel Monitoring
414
+
415
+ | Metric | Location | Action Threshold |
416
+ | ----------------- | ---------------- | ---------------- |
417
+ | Build Time | Deployments tab | > 5 minutes |
418
+ | Function Duration | Functions tab | > 10 seconds |
419
+ | Function Errors | Functions → Logs | Any error |
420
+ | Edge Latency | Analytics | > 500ms |
421
+
422
+ ### Supabase Monitoring
423
+
424
+ | Metric | Location | Action Threshold |
425
+ | ------------------ | --------------------- | ---------------- |
426
+ | Database Size | Settings → Billing | 80% of limit |
427
+ | Active Connections | Database → Roles | 80% of limit |
428
+ | API Requests | Settings → Billing | Unusual spikes |
429
+ | Auth Events | Authentication → Logs | Failed attempts |
430
+
431
+ ### Recommended Integrations
432
+
433
+ | Service | Purpose |
434
+ | ---------------- | ----------------------------- |
435
+ | Sentry | Error tracking, stack traces |
436
+ | Vercel Analytics | Web vitals, performance |
437
+ | Supabase Logs | Database queries, auth events |
438
+
439
+ ### Setting Up Error Alerts
440
+
441
+ ```bash
442
+ # Add Sentry (optional)
443
+ pnpm add @sentry/nextjs
444
+
445
+ # Configure in sentry.client.config.ts
446
+ # Configure in sentry.server.config.ts
447
+ # Add SENTRY_DSN to environment variables
448
+ ```
449
+
450
+ ---
451
+
452
+ ## Quick Reference
453
+
454
+ ### Deploy Commands
455
+
456
+ ```bash
457
+ # Local development
458
+ pnpm dev
459
+
460
+ # Build locally
461
+ pnpm build
462
+
463
+ # Deploy to preview
464
+ vercel
465
+
466
+ # Deploy to production
467
+ vercel --prod
468
+
469
+ # Check deployment status
470
+ vercel ls
471
+ ```
472
+
473
+ ### Migration Commands
474
+
475
+ ```bash
476
+ # Start local Supabase
477
+ supabase start
478
+
479
+ # Run migrations locally
480
+ supabase db push
481
+
482
+ # Generate types
483
+ supabase gen types typescript --local > types/supabase.ts
484
+
485
+ # Link to remote project
486
+ supabase link --project-ref <ref>
487
+
488
+ # Push migrations to remote
489
+ supabase db push
490
+ ```
491
+
492
+ ### Rollback Commands
493
+
494
+ ```bash
495
+ # Rollback to previous deployment
496
+ vercel rollback
497
+
498
+ # Rollback to specific deployment
499
+ vercel rollback <deployment-url>
500
+ ```
501
+
502
+ ---
503
+
504
+ ## Related Documents
505
+
506
+ - [VERCEL_DEPLOYMENT_GUIDE.md](../VERCEL_DEPLOYMENT_GUIDE.md) - Initial setup guide
507
+ - [BRANCHING_STRATEGY.md](BRANCHING_STRATEGY.md) - Branch and PR workflow
508
+ - [TESTING_STRATEGY.md](TESTING_STRATEGY.md) - Testing requirements
509
+ - [SINGLE_SOURCE_OF_TRUTH.md](SINGLE_SOURCE_OF_TRUTH.md) - Service locations
@@ -0,0 +1,62 @@
1
+ **Add your own guidelines here**
2
+
3
+ <!--
4
+
5
+ System Guidelines
6
+
7
+ Use this file to provide the AI with rules and guidelines you want it to follow.
8
+ This template outlines a few examples of things you can add. You can add your own sections and format it to suit your needs
9
+
10
+ TIP: More context isn't always better. It can confuse the LLM. Try and add the most important rules you need
11
+
12
+ # General guidelines
13
+
14
+ Any general rules you want the AI to follow.
15
+ For example:
16
+
17
+ * Only use absolute positioning when necessary. Opt for responsive and well structured layouts that use flexbox and grid by default
18
+ * Refactor code as you go to keep code clean
19
+ * Keep file sizes small and put helper functions and components in their own files.
20
+
21
+ --------------
22
+
23
+ # Design system guidelines
24
+ Rules for how the AI should make generations look like your company's design system
25
+
26
+ Additionally, if you select a design system to use in the prompt box, you can reference
27
+ your design system's components, tokens, variables and components.
28
+ For example:
29
+
30
+ * Use a base font-size of 14px
31
+ * Date formats should always be in the format “Jun 10”
32
+ * The bottom toolbar should only ever have a maximum of 4 items
33
+ * Never use the floating action button with the bottom toolbar
34
+ * Chips should always come in sets of 3 or more
35
+ * Don't use a dropdown if there are 2 or fewer options
36
+
37
+ You can also create sub sections and add more specific details
38
+ For example:
39
+
40
+
41
+ ## Button
42
+ The Button component is a fundamental interactive element in our design system, designed to trigger actions or navigate
43
+ users through the application. It provides visual feedback and clear affordances to enhance user experience.
44
+
45
+ ### Usage
46
+ Buttons should be used for important actions that users need to take, such as form submissions, confirming choices,
47
+ or initiating processes. They communicate interactivity and should have clear, action-oriented labels.
48
+
49
+ ### Variants
50
+ * Primary Button
51
+ * Purpose : Used for the main action in a section or page
52
+ * Visual Style : Bold, filled with the primary brand color
53
+ * Usage : One primary button per section to guide users toward the most important action
54
+ * Secondary Button
55
+ * Purpose : Used for alternative or supporting actions
56
+ * Visual Style : Outlined with the primary color, transparent background
57
+ * Usage : Can appear alongside a primary button for less important actions
58
+ * Tertiary Button
59
+ * Purpose : Used for the least important actions
60
+ * Visual Style : Text-only with no border, using primary color
61
+ * Usage : For actions that should be available but not emphasized
62
+ -->