@intentsolutionsio/vercel-pack 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/.claude-plugin/plugin.json +17 -0
  2. package/000-docs/001-BL-LICN-license.txt +3 -0
  3. package/LICENSE +21 -0
  4. package/README.md +69 -0
  5. package/package.json +43 -0
  6. package/skills/vercel-advanced-troubleshooting/SKILL.md +261 -0
  7. package/skills/vercel-architecture-variants/SKILL.md +284 -0
  8. package/skills/vercel-ci-integration/SKILL.md +124 -0
  9. package/skills/vercel-common-errors/SKILL.md +109 -0
  10. package/skills/vercel-cost-tuning/SKILL.md +201 -0
  11. package/skills/vercel-data-handling/SKILL.md +220 -0
  12. package/skills/vercel-debug-bundle/SKILL.md +111 -0
  13. package/skills/vercel-deploy-integration/SKILL.md +209 -0
  14. package/skills/vercel-deploy-preview/SKILL.md +71 -0
  15. package/skills/vercel-edge-functions/SKILL.md +73 -0
  16. package/skills/vercel-enterprise-rbac/SKILL.md +222 -0
  17. package/skills/vercel-hello-world/SKILL.md +96 -0
  18. package/skills/vercel-incident-runbook/SKILL.md +203 -0
  19. package/skills/vercel-install-auth/SKILL.md +90 -0
  20. package/skills/vercel-known-pitfalls/SKILL.md +334 -0
  21. package/skills/vercel-load-scale/SKILL.md +274 -0
  22. package/skills/vercel-local-dev-loop/SKILL.md +117 -0
  23. package/skills/vercel-migration-deep-dive/SKILL.md +244 -0
  24. package/skills/vercel-multi-env-setup/SKILL.md +222 -0
  25. package/skills/vercel-observability/SKILL.md +250 -0
  26. package/skills/vercel-performance-tuning/SKILL.md +214 -0
  27. package/skills/vercel-policy-guardrails/SKILL.md +257 -0
  28. package/skills/vercel-prod-checklist/SKILL.md +119 -0
  29. package/skills/vercel-rate-limits/SKILL.md +149 -0
  30. package/skills/vercel-reference-architecture/SKILL.md +238 -0
  31. package/skills/vercel-reliability-patterns/SKILL.md +290 -0
  32. package/skills/vercel-sdk-patterns/SKILL.md +147 -0
  33. package/skills/vercel-security-basics/SKILL.md +140 -0
  34. package/skills/vercel-upgrade-migration/SKILL.md +112 -0
  35. package/skills/vercel-webhooks-events/SKILL.md +199 -0
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: vercel-debug-bundle
3
+ description: |
4
+ Collect Vercel debug evidence for support tickets and troubleshooting.
5
+ Use when encountering persistent issues, preparing support tickets,
6
+ or collecting diagnostic information for Vercel problems.
7
+ Trigger with phrases like "vercel debug", "vercel support bundle",
8
+ "collect vercel logs", "vercel diagnostic".
9
+ allowed-tools: Read, Bash(grep:*), Bash(curl:*), Bash(tar:*), Grep
10
+ version: 1.0.0
11
+ license: MIT
12
+ author: Jeremy Longshore <jeremy@intentsolutions.io>
13
+ ---
14
+
15
+ # Vercel Debug Bundle
16
+
17
+ ## Overview
18
+ Collect all necessary diagnostic information for Vercel support tickets.
19
+
20
+ ## Prerequisites
21
+ - Vercel SDK installed
22
+ - Access to application logs
23
+ - Permission to collect environment info
24
+
25
+ ## Instructions
26
+
27
+ ### Step 1: Create Debug Bundle Script
28
+ ```bash
29
+ #!/bin/bash
30
+ # vercel-debug-bundle.sh
31
+
32
+ BUNDLE_DIR="vercel-debug-$(date +%Y%m%d-%H%M%S)"
33
+ mkdir -p "$BUNDLE_DIR"
34
+
35
+ echo "=== Vercel Debug Bundle ===" > "$BUNDLE_DIR/summary.txt"
36
+ echo "Generated: $(date)" >> "$BUNDLE_DIR/summary.txt"
37
+ ```
38
+
39
+ ### Step 2: Collect Environment Info
40
+ ```bash
41
+ # Environment info
42
+ echo "--- Environment ---" >> "$BUNDLE_DIR/summary.txt"
43
+ node --version >> "$BUNDLE_DIR/summary.txt" 2>&1
44
+ npm --version >> "$BUNDLE_DIR/summary.txt" 2>&1
45
+ echo "VERCEL_API_KEY: ${VERCEL_API_KEY:+[SET]}" >> "$BUNDLE_DIR/summary.txt"
46
+ ```
47
+
48
+ ### Step 3: Gather SDK and Logs
49
+ ```bash
50
+ # SDK version
51
+ npm list vercel 2>/dev/null >> "$BUNDLE_DIR/summary.txt"
52
+
53
+ # Recent logs (redacted)
54
+ grep -i "vercel" ~/.npm/_logs/*.log 2>/dev/null | tail -50 >> "$BUNDLE_DIR/logs.txt"
55
+
56
+ # Configuration (redacted - secrets masked)
57
+ echo "--- Config (redacted) ---" >> "$BUNDLE_DIR/summary.txt"
58
+ cat .env 2>/dev/null | sed 's/=.*/=***REDACTED***/' >> "$BUNDLE_DIR/config-redacted.txt"
59
+
60
+ # Network connectivity test
61
+ echo "--- Network Test ---" >> "$BUNDLE_DIR/summary.txt"
62
+ echo -n "API Health: " >> "$BUNDLE_DIR/summary.txt"
63
+ curl -s -o /dev/null -w "%{http_code}" https://api.vercel.com/health >> "$BUNDLE_DIR/summary.txt"
64
+ echo "" >> "$BUNDLE_DIR/summary.txt"
65
+ ```
66
+
67
+ ### Step 4: Package Bundle
68
+ ```bash
69
+ tar -czf "$BUNDLE_DIR.tar.gz" "$BUNDLE_DIR"
70
+ echo "Bundle created: $BUNDLE_DIR.tar.gz"
71
+ ```
72
+
73
+ ## Output
74
+ - `vercel-debug-YYYYMMDD-HHMMSS.tar.gz` archive containing:
75
+ - `summary.txt` - Environment and SDK info
76
+ - `logs.txt` - Recent redacted logs
77
+ - `config-redacted.txt` - Configuration (secrets removed)
78
+
79
+ ## Error Handling
80
+ | Item | Purpose | Included |
81
+ |------|---------|----------|
82
+ | Environment versions | Compatibility check | ✓ |
83
+ | SDK version | Version-specific bugs | ✓ |
84
+ | Error logs (redacted) | Root cause analysis | ✓ |
85
+ | Config (redacted) | Configuration issues | ✓ |
86
+ | Network test | Connectivity issues | ✓ |
87
+
88
+ ## Examples
89
+
90
+ ### Sensitive Data Handling
91
+ **ALWAYS REDACT:**
92
+ - API keys and tokens
93
+ - Passwords and secrets
94
+ - PII (emails, names, IDs)
95
+
96
+ **Safe to Include:**
97
+ - Error messages
98
+ - Stack traces (redacted)
99
+ - SDK/runtime versions
100
+
101
+ ### Submit to Support
102
+ 1. Create bundle: `bash vercel-debug-bundle.sh`
103
+ 2. Review for sensitive data
104
+ 3. Upload to Vercel support portal
105
+
106
+ ## Resources
107
+ - [Vercel Support](https://vercel.com/docs/support)
108
+ - [Vercel Status](https://www.vercel-status.com)
109
+
110
+ ## Next Steps
111
+ For rate limit issues, see `vercel-rate-limits`.
@@ -0,0 +1,209 @@
1
+ ---
2
+ name: vercel-deploy-integration
3
+ description: |
4
+ Deploy Vercel integrations to Vercel, Fly.io, and Cloud Run platforms.
5
+ Use when deploying Vercel-powered applications to production,
6
+ configuring platform-specific secrets, or setting up deployment pipelines.
7
+ Trigger with phrases like "deploy vercel", "vercel Vercel",
8
+ "vercel production deploy", "vercel Cloud Run", "vercel Fly.io".
9
+ allowed-tools: Read, Write, Edit, Bash(vercel:*), Bash(fly:*), Bash(gcloud:*)
10
+ version: 1.0.0
11
+ license: MIT
12
+ author: Jeremy Longshore <jeremy@intentsolutions.io>
13
+ ---
14
+
15
+ # Vercel Deploy Integration
16
+
17
+ ## Overview
18
+ Deploy Vercel-powered applications to popular platforms with proper secrets management.
19
+
20
+ ## Prerequisites
21
+ - Vercel API keys for production environment
22
+ - Platform CLI installed (vercel, fly, or gcloud)
23
+ - Application code ready for deployment
24
+ - Environment variables documented
25
+
26
+ ## Vercel Deployment
27
+
28
+ ### Environment Setup
29
+ ```bash
30
+ # Add Vercel secrets to Vercel
31
+ vercel secrets add vercel_api_key sk_live_***
32
+ vercel secrets add vercel_webhook_secret whsec_***
33
+
34
+ # Link to project
35
+ vercel link
36
+
37
+ # Deploy preview
38
+ vercel
39
+
40
+ # Deploy production
41
+ vercel --prod
42
+ ```
43
+
44
+ ### vercel.json Configuration
45
+ ```json
46
+ {
47
+ "env": {
48
+ "VERCEL_API_KEY": "@vercel_api_key"
49
+ },
50
+ "functions": {
51
+ "api/**/*.ts": {
52
+ "maxDuration": 30
53
+ }
54
+ }
55
+ }
56
+ ```
57
+
58
+ ## Fly.io Deployment
59
+
60
+ ### fly.toml
61
+ ```toml
62
+ app = "my-vercel-app"
63
+ primary_region = "iad1"
64
+
65
+ [env]
66
+ NODE_ENV = "production"
67
+
68
+ [http_service]
69
+ internal_port = 3000
70
+ force_https = true
71
+ auto_stop_machines = true
72
+ auto_start_machines = true
73
+ ```
74
+
75
+ ### Secrets
76
+ ```bash
77
+ # Set Vercel secrets
78
+ fly secrets set VERCEL_API_KEY=sk_live_***
79
+ fly secrets set VERCEL_WEBHOOK_SECRET=whsec_***
80
+
81
+ # Deploy
82
+ fly deploy
83
+ ```
84
+
85
+ ## Google Cloud Run
86
+
87
+ ### Dockerfile
88
+ ```dockerfile
89
+ FROM node:20-slim
90
+ WORKDIR /app
91
+ COPY package*.json ./
92
+ RUN npm ci --only=production
93
+ COPY . .
94
+ CMD ["npm", "start"]
95
+ ```
96
+
97
+ ### Deploy Script
98
+ ```bash
99
+ #!/bin/bash
100
+ # deploy-cloud-run.sh
101
+
102
+ PROJECT_ID="${GOOGLE_CLOUD_PROJECT}"
103
+ SERVICE_NAME="vercel-service"
104
+ REGION="None"
105
+
106
+ # Build and push image
107
+ gcloud builds submit --tag gcr.io/$PROJECT_ID/$SERVICE_NAME
108
+
109
+ # Deploy to Cloud Run
110
+ gcloud run deploy $SERVICE_NAME \
111
+ --image gcr.io/$PROJECT_ID/$SERVICE_NAME \
112
+ --region $REGION \
113
+ --platform managed \
114
+ --allow-unauthenticated \
115
+ --set-secrets=VERCEL_API_KEY=vercel-api-key:latest
116
+ ```
117
+
118
+ ## Environment Configuration Pattern
119
+
120
+ ```typescript
121
+ // config/vercel.ts
122
+ interface VercelConfig {
123
+ apiKey: string;
124
+ environment: 'development' | 'staging' | 'production';
125
+ webhookSecret?: string;
126
+ }
127
+
128
+ export function getVercelConfig(): VercelConfig {
129
+ const env = process.env.NODE_ENV || 'development';
130
+
131
+ return {
132
+ apiKey: process.env.VERCEL_API_KEY!,
133
+ environment: env as VercelConfig['environment'],
134
+ webhookSecret: process.env.VERCEL_WEBHOOK_SECRET,
135
+ };
136
+ }
137
+ ```
138
+
139
+ ## Health Check Endpoint
140
+
141
+ ```typescript
142
+ // api/health.ts
143
+ export async function GET() {
144
+ const vercelStatus = await checkVercelConnection();
145
+
146
+ return Response.json({
147
+ status: vercelStatus ? 'healthy' : 'degraded',
148
+ services: {
149
+ vercel: vercelStatus,
150
+ },
151
+ timestamp: new Date().toISOString(),
152
+ });
153
+ }
154
+ ```
155
+
156
+ ## Instructions
157
+
158
+ ### Step 1: Choose Deployment Platform
159
+ Select the platform that best fits your infrastructure needs and follow the platform-specific guide below.
160
+
161
+ ### Step 2: Configure Secrets
162
+ Store Vercel API keys securely using the platform's secrets management.
163
+
164
+ ### Step 3: Deploy Application
165
+ Use the platform CLI to deploy your application with Vercel integration.
166
+
167
+ ### Step 4: Verify Health
168
+ Test the health check endpoint to confirm Vercel connectivity.
169
+
170
+ ## Output
171
+ - Application deployed to production
172
+ - Vercel secrets securely configured
173
+ - Health check endpoint functional
174
+ - Environment-specific configuration in place
175
+
176
+ ## Error Handling
177
+ | Issue | Cause | Solution |
178
+ |-------|-------|----------|
179
+ | Secret not found | Missing configuration | Add secret via platform CLI |
180
+ | Deploy timeout | Large build | Increase build timeout |
181
+ | Health check fails | Wrong API key | Verify environment variable |
182
+ | Cold start issues | No warm-up | Configure minimum instances |
183
+
184
+ ## Examples
185
+
186
+ ### Quick Deploy Script
187
+ ```bash
188
+ #!/bin/bash
189
+ # Platform-agnostic deploy helper
190
+ case "$1" in
191
+ vercel)
192
+ vercel secrets add vercel_api_key "$VERCEL_API_KEY"
193
+ vercel --prod
194
+ ;;
195
+ fly)
196
+ fly secrets set VERCEL_API_KEY="$VERCEL_API_KEY"
197
+ fly deploy
198
+ ;;
199
+ esac
200
+ ```
201
+
202
+ ## Resources
203
+ - [Vercel Documentation](https://vercel.com/docs)
204
+ - [Fly.io Documentation](https://fly.io/docs)
205
+ - [Cloud Run Documentation](https://cloud.google.com/run/docs)
206
+ - [Vercel Deploy Guide](https://vercel.com/docs/deploy)
207
+
208
+ ## Next Steps
209
+ For webhook handling, see `vercel-webhooks-events`.
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: vercel-deploy-preview
3
+ description: |
4
+ Execute Vercel primary workflow: Deploy Preview.
5
+ Use when Deploying a preview for a pull request,
6
+ Testing changes before production, or Sharing preview URLs with stakeholders.
7
+ Trigger with phrases like "vercel deploy preview",
8
+ "create preview deployment with vercel".
9
+ allowed-tools: Read, Write, Edit, Bash(npm:*), Grep
10
+ version: 1.0.0
11
+ license: MIT
12
+ author: Jeremy Longshore <jeremy@intentsolutions.io>
13
+ ---
14
+
15
+ # Vercel Deploy Preview
16
+
17
+ ## Overview
18
+ Deploy preview environments for pull requests and branches.
19
+ This is the primary workflow for Vercel - instant previews for every commit.
20
+
21
+
22
+ ## Prerequisites
23
+ - Completed `vercel-install-auth` setup
24
+ - Understanding of Vercel core concepts
25
+ - Valid API credentials configured
26
+
27
+ ## Instructions
28
+
29
+ ### Step 1: Initialize
30
+ ```typescript
31
+ // Step 1 implementation
32
+ ```
33
+
34
+ ### Step 2: Execute
35
+ ```typescript
36
+ // Step 2 implementation
37
+ ```
38
+
39
+ ### Step 3: Finalize
40
+ ```typescript
41
+ // Step 3 implementation
42
+ ```
43
+
44
+ ## Output
45
+ - Completed Deploy Preview execution
46
+ - Expected results from Vercel API
47
+ - Success confirmation or error details
48
+
49
+ ## Error Handling
50
+ | Error | Cause | Solution |
51
+ |-------|-------|----------|
52
+ | Error 1 | Cause | Solution |
53
+ | Error 2 | Cause | Solution |
54
+
55
+ ## Examples
56
+
57
+ ### Complete Workflow
58
+ ```typescript
59
+ // Complete workflow example
60
+ ```
61
+
62
+ ### Common Variations
63
+ - Variation 1: Description
64
+ - Variation 2: Description
65
+
66
+ ## Resources
67
+ - [Vercel Documentation](https://vercel.com/docs)
68
+ - [Vercel API Reference](https://vercel.com/docs/api)
69
+
70
+ ## Next Steps
71
+ For secondary workflow, see `vercel-edge-functions`.
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: vercel-edge-functions
3
+ description: |
4
+ Execute Vercel secondary workflow: Edge Functions.
5
+ Use when API routes with minimal latency,
6
+ or complementing primary workflow.
7
+ Trigger with phrases like "vercel edge function",
8
+ "deploy edge function with vercel".
9
+ allowed-tools: Read, Write, Edit, Bash(npm:*), Grep
10
+ version: 1.0.0
11
+ license: MIT
12
+ author: Jeremy Longshore <jeremy@intentsolutions.io>
13
+ ---
14
+
15
+ # Vercel Edge Functions
16
+
17
+ ## Overview
18
+ Build and deploy Edge Functions for ultra-low latency at the edge.
19
+ Serverless functions that run close to users worldwide.
20
+
21
+
22
+ ## Prerequisites
23
+ - Completed `vercel-install-auth` setup
24
+ - Familiarity with `vercel-deploy-preview`
25
+ - Valid API credentials configured
26
+
27
+ ## Instructions
28
+
29
+ ### Step 1: Setup
30
+ ```typescript
31
+ // Step 1 implementation
32
+ ```
33
+
34
+ ### Step 2: Process
35
+ ```typescript
36
+ // Step 2 implementation
37
+ ```
38
+
39
+ ### Step 3: Complete
40
+ ```typescript
41
+ // Step 3 implementation
42
+ ```
43
+
44
+ ## Output
45
+ - Completed Edge Functions execution
46
+ - Results from Vercel API
47
+ - Success confirmation or error details
48
+
49
+ ## Error Handling
50
+ | Aspect | Deploy Preview | Edge Functions |
51
+ |--------|------------|------------|
52
+ | Use Case | Deploying a preview for a pull request | API routes with minimal latency |
53
+ | Complexity | Medium | Medium |
54
+ | Performance | Standard | Ultra-fast (<50ms) |
55
+
56
+ ## Examples
57
+
58
+ ### Complete Workflow
59
+ ```typescript
60
+ // Complete workflow example
61
+ ```
62
+
63
+ ### Error Recovery
64
+ ```typescript
65
+ // Error handling code
66
+ ```
67
+
68
+ ## Resources
69
+ - [Vercel Documentation](https://vercel.com/docs)
70
+ - [Vercel API Reference](https://vercel.com/docs/api)
71
+
72
+ ## Next Steps
73
+ For common errors, see `vercel-common-errors`.
@@ -0,0 +1,222 @@
1
+ ---
2
+ name: vercel-enterprise-rbac
3
+ description: |
4
+ Configure Vercel enterprise SSO, role-based access control, and organization management.
5
+ Use when implementing SSO integration, configuring role-based permissions,
6
+ or setting up organization-level controls for Vercel.
7
+ Trigger with phrases like "vercel SSO", "vercel RBAC",
8
+ "vercel enterprise", "vercel roles", "vercel permissions", "vercel SAML".
9
+ allowed-tools: Read, Write, Edit
10
+ version: 1.0.0
11
+ license: MIT
12
+ author: Jeremy Longshore <jeremy@intentsolutions.io>
13
+ ---
14
+
15
+ # Vercel Enterprise RBAC
16
+
17
+ ## Overview
18
+ Configure enterprise-grade access control for Vercel integrations.
19
+
20
+ ## Prerequisites
21
+ - Vercel Enterprise tier subscription
22
+ - Identity Provider (IdP) with SAML/OIDC support
23
+ - Understanding of role-based access patterns
24
+ - Audit logging infrastructure
25
+
26
+ ## Role Definitions
27
+
28
+ | Role | Permissions | Use Case |
29
+ |------|-------------|----------|
30
+ | Admin | Full access | Platform administrators |
31
+ | Developer | Read/write, no delete | Active development |
32
+ | Viewer | Read-only | Stakeholders, auditors |
33
+ | Service | API access only | Automated systems |
34
+
35
+ ## Role Implementation
36
+
37
+ ```typescript
38
+ enum VercelRole {
39
+ Admin = 'admin',
40
+ Developer = 'developer',
41
+ Viewer = 'viewer',
42
+ Service = 'service',
43
+ }
44
+
45
+ interface VercelPermissions {
46
+ read: boolean;
47
+ write: boolean;
48
+ delete: boolean;
49
+ admin: boolean;
50
+ }
51
+
52
+ const ROLE_PERMISSIONS: Record<VercelRole, VercelPermissions> = {
53
+ admin: { read: true, write: true, delete: true, admin: true },
54
+ developer: { read: true, write: true, delete: false, admin: false },
55
+ viewer: { read: true, write: false, delete: false, admin: false },
56
+ service: { read: true, write: true, delete: false, admin: false },
57
+ };
58
+
59
+ function checkPermission(
60
+ role: VercelRole,
61
+ action: keyof VercelPermissions
62
+ ): boolean {
63
+ return ROLE_PERMISSIONS[role][action];
64
+ }
65
+ ```
66
+
67
+ ## SSO Integration
68
+
69
+ ### SAML Configuration
70
+
71
+ ```typescript
72
+ // Vercel SAML setup
73
+ const samlConfig = {
74
+ entryPoint: 'https://idp.company.com/saml/sso',
75
+ issuer: 'https://vercel.com/saml/metadata',
76
+ cert: process.env.SAML_CERT,
77
+ callbackUrl: 'https://app.yourcompany.com/auth/vercel/callback',
78
+ };
79
+
80
+ // Map IdP groups to Vercel roles
81
+ const groupRoleMapping: Record<string, VercelRole> = {
82
+ 'Engineering': VercelRole.Developer,
83
+ 'Platform-Admins': VercelRole.Admin,
84
+ 'Data-Team': VercelRole.Viewer,
85
+ };
86
+ ```
87
+
88
+ ### OAuth2/OIDC Integration
89
+
90
+ ```typescript
91
+ import { OAuth2Client } from 'vercel';
92
+
93
+ const oauthClient = new OAuth2Client({
94
+ clientId: process.env.VERCEL_OAUTH_CLIENT_ID!,
95
+ clientSecret: process.env.VERCEL_OAUTH_CLIENT_SECRET!,
96
+ redirectUri: 'https://app.yourcompany.com/auth/vercel/callback',
97
+ scopes: read, write, deploy,
98
+ });
99
+ ```
100
+
101
+ ## Organization Management
102
+
103
+ ```typescript
104
+ interface VercelOrganization {
105
+ id: string;
106
+ name: string;
107
+ ssoEnabled: boolean;
108
+ enforceSso: boolean;
109
+ allowedDomains: string[];
110
+ defaultRole: VercelRole;
111
+ }
112
+
113
+ async function createOrganization(
114
+ config: VercelOrganization
115
+ ): Promise<void> {
116
+ await vercelClient.organizations.create({
117
+ ...config,
118
+ settings: {
119
+ sso: {
120
+ enabled: config.ssoEnabled,
121
+ enforced: config.enforceSso,
122
+ domains: config.allowedDomains,
123
+ },
124
+ },
125
+ });
126
+ }
127
+ ```
128
+
129
+ ## Access Control Middleware
130
+
131
+ ```typescript
132
+ function requireVercelPermission(
133
+ requiredPermission: keyof VercelPermissions
134
+ ) {
135
+ return async (req: Request, res: Response, next: NextFunction) => {
136
+ const user = req.user as { vercelRole: VercelRole };
137
+
138
+ if (!checkPermission(user.vercelRole, requiredPermission)) {
139
+ return res.status(403).json({
140
+ error: 'Forbidden',
141
+ message: `Missing permission: ${requiredPermission}`,
142
+ });
143
+ }
144
+
145
+ next();
146
+ };
147
+ }
148
+
149
+ // Usage
150
+ app.delete('/vercel/resource/:id',
151
+ requireVercelPermission('delete'),
152
+ deleteResourceHandler
153
+ );
154
+ ```
155
+
156
+ ## Audit Trail
157
+
158
+ ```typescript
159
+ interface VercelAuditEntry {
160
+ timestamp: Date;
161
+ userId: string;
162
+ role: VercelRole;
163
+ action: string;
164
+ resource: string;
165
+ success: boolean;
166
+ ipAddress: string;
167
+ }
168
+
169
+ async function logVercelAccess(entry: VercelAuditEntry): Promise<void> {
170
+ await auditDb.insert(entry);
171
+
172
+ // Alert on suspicious activity
173
+ if (entry.action === 'delete' && !entry.success) {
174
+ await alertOnSuspiciousActivity(entry);
175
+ }
176
+ }
177
+ ```
178
+
179
+ ## Instructions
180
+
181
+ ### Step 1: Define Roles
182
+ Map organizational roles to Vercel permissions.
183
+
184
+ ### Step 2: Configure SSO
185
+ Set up SAML or OIDC integration with your IdP.
186
+
187
+ ### Step 3: Implement Middleware
188
+ Add permission checks to API endpoints.
189
+
190
+ ### Step 4: Enable Audit Logging
191
+ Track all access for compliance.
192
+
193
+ ## Output
194
+ - Role definitions implemented
195
+ - SSO integration configured
196
+ - Permission middleware active
197
+ - Audit trail enabled
198
+
199
+ ## Error Handling
200
+ | Issue | Cause | Solution |
201
+ |-------|-------|----------|
202
+ | SSO login fails | Wrong callback URL | Verify IdP config |
203
+ | Permission denied | Missing role mapping | Update group mappings |
204
+ | Token expired | Short TTL | Refresh token logic |
205
+ | Audit gaps | Async logging failed | Check log pipeline |
206
+
207
+ ## Examples
208
+
209
+ ### Quick Permission Check
210
+ ```typescript
211
+ if (!checkPermission(user.role, 'write')) {
212
+ throw new ForbiddenError('Write permission required');
213
+ }
214
+ ```
215
+
216
+ ## Resources
217
+ - [Vercel Enterprise Guide](https://vercel.com/docs/enterprise)
218
+ - [SAML 2.0 Specification](https://wiki.oasis-open.org/security/FrontPage)
219
+ - [OpenID Connect Spec](https://openid.net/specs/openid-connect-core-1_0.html)
220
+
221
+ ## Next Steps
222
+ For major migrations, see `vercel-migration-deep-dive`.