@howlil/ez-agents 3.4.1 → 3.4.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.
Files changed (102) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +7 -18
  3. package/bin/install.js +52 -10
  4. package/commands/ez/join-discord.md +18 -18
  5. package/ez-agents/bin/lib/assistant-adapter.cjs +264 -264
  6. package/ez-agents/bin/lib/audit-exec.cjs +7 -2
  7. package/ez-agents/bin/lib/circuit-breaker.cjs +118 -118
  8. package/ez-agents/bin/lib/config.cjs +190 -190
  9. package/ez-agents/bin/lib/file-lock.cjs +236 -236
  10. package/ez-agents/bin/lib/frontmatter.cjs +299 -299
  11. package/ez-agents/bin/lib/fs-utils.cjs +153 -153
  12. package/ez-agents/bin/lib/git-utils.cjs +203 -203
  13. package/ez-agents/bin/lib/index.cjs +113 -113
  14. package/ez-agents/bin/lib/init.cjs +757 -757
  15. package/ez-agents/bin/lib/logger.cjs +47 -17
  16. package/ez-agents/bin/lib/milestone.cjs +241 -241
  17. package/ez-agents/bin/lib/model-provider.cjs +241 -241
  18. package/ez-agents/bin/lib/phase.cjs +925 -925
  19. package/ez-agents/bin/lib/planning-write.cjs +107 -107
  20. package/ez-agents/bin/lib/retry.cjs +119 -119
  21. package/ez-agents/bin/lib/roadmap.cjs +306 -306
  22. package/ez-agents/bin/lib/safe-exec.cjs +90 -4
  23. package/ez-agents/bin/lib/safe-path.cjs +130 -130
  24. package/ez-agents/bin/lib/state.cjs +736 -736
  25. package/ez-agents/bin/lib/temp-file.cjs +239 -239
  26. package/ez-agents/bin/lib/template.cjs +223 -223
  27. package/ez-agents/bin/lib/test-file-lock.cjs +112 -112
  28. package/ez-agents/bin/lib/test-graceful.cjs +93 -93
  29. package/ez-agents/bin/lib/test-logger.cjs +60 -60
  30. package/ez-agents/bin/lib/test-safe-exec.cjs +38 -38
  31. package/ez-agents/bin/lib/test-safe-path.cjs +33 -33
  32. package/ez-agents/bin/lib/test-temp-file.cjs +125 -125
  33. package/ez-agents/bin/lib/timeout-exec.cjs +63 -63
  34. package/ez-agents/bin/lib/verify.cjs +15 -1
  35. package/ez-agents/references/checkpoints.md +776 -776
  36. package/ez-agents/references/continuation-format.md +249 -249
  37. package/ez-agents/references/questioning.md +162 -162
  38. package/ez-agents/references/tdd.md +263 -263
  39. package/ez-agents/templates/codebase/concerns.md +310 -310
  40. package/ez-agents/templates/codebase/conventions.md +307 -307
  41. package/ez-agents/templates/codebase/integrations.md +280 -280
  42. package/ez-agents/templates/codebase/stack.md +186 -186
  43. package/ez-agents/templates/codebase/testing.md +480 -480
  44. package/ez-agents/templates/config.json +37 -37
  45. package/ez-agents/templates/continue-here.md +78 -78
  46. package/ez-agents/templates/milestone-archive.md +123 -123
  47. package/ez-agents/templates/milestone.md +115 -115
  48. package/ez-agents/templates/requirements.md +231 -231
  49. package/ez-agents/templates/research-project/ARCHITECTURE.md +204 -204
  50. package/ez-agents/templates/research-project/FEATURES.md +147 -147
  51. package/ez-agents/templates/research-project/PITFALLS.md +200 -200
  52. package/ez-agents/templates/research-project/STACK.md +120 -120
  53. package/ez-agents/templates/research-project/SUMMARY.md +170 -170
  54. package/ez-agents/templates/retrospective.md +54 -54
  55. package/ez-agents/templates/roadmap.md +202 -202
  56. package/ez-agents/templates/summary-minimal.md +41 -41
  57. package/ez-agents/templates/summary-standard.md +48 -48
  58. package/ez-agents/templates/summary.md +248 -248
  59. package/ez-agents/templates/user-setup.md +311 -311
  60. package/ez-agents/templates/verification-report.md +322 -322
  61. package/ez-agents/workflows/add-phase.md +112 -112
  62. package/ez-agents/workflows/add-tests.md +351 -351
  63. package/ez-agents/workflows/add-todo.md +158 -158
  64. package/ez-agents/workflows/audit-milestone.md +332 -332
  65. package/ez-agents/workflows/autonomous.md +743 -743
  66. package/ez-agents/workflows/check-todos.md +177 -177
  67. package/ez-agents/workflows/cleanup.md +152 -152
  68. package/ez-agents/workflows/complete-milestone.md +766 -766
  69. package/ez-agents/workflows/diagnose-issues.md +219 -219
  70. package/ez-agents/workflows/discovery-phase.md +289 -289
  71. package/ez-agents/workflows/discuss-phase.md +762 -762
  72. package/ez-agents/workflows/execute-phase.md +468 -468
  73. package/ez-agents/workflows/execute-plan.md +483 -483
  74. package/ez-agents/workflows/health.md +159 -159
  75. package/ez-agents/workflows/help.md +492 -492
  76. package/ez-agents/workflows/insert-phase.md +130 -130
  77. package/ez-agents/workflows/list-phase-assumptions.md +178 -178
  78. package/ez-agents/workflows/map-codebase.md +316 -316
  79. package/ez-agents/workflows/new-milestone.md +384 -384
  80. package/ez-agents/workflows/new-project.md +1113 -1113
  81. package/ez-agents/workflows/node-repair.md +92 -92
  82. package/ez-agents/workflows/pause-work.md +122 -122
  83. package/ez-agents/workflows/plan-milestone-gaps.md +274 -274
  84. package/ez-agents/workflows/plan-phase.md +651 -651
  85. package/ez-agents/workflows/progress.md +382 -382
  86. package/ez-agents/workflows/quick.md +610 -610
  87. package/ez-agents/workflows/remove-phase.md +155 -155
  88. package/ez-agents/workflows/research-phase.md +74 -74
  89. package/ez-agents/workflows/resume-project.md +307 -307
  90. package/ez-agents/workflows/set-profile.md +81 -81
  91. package/ez-agents/workflows/settings.md +242 -242
  92. package/ez-agents/workflows/stats.md +57 -57
  93. package/ez-agents/workflows/transition.md +544 -544
  94. package/ez-agents/workflows/ui-phase.md +290 -290
  95. package/ez-agents/workflows/ui-review.md +157 -157
  96. package/ez-agents/workflows/update.md +320 -320
  97. package/ez-agents/workflows/validate-phase.md +167 -167
  98. package/ez-agents/workflows/verify-phase.md +243 -243
  99. package/ez-agents/workflows/verify-work.md +584 -584
  100. package/package.json +2 -3
  101. package/scripts/build-hooks.js +43 -43
  102. package/scripts/run-tests.cjs +29 -29
@@ -1,280 +1,280 @@
1
- # External Integrations Template
2
-
3
- Template for `.planning/codebase/INTEGRATIONS.md` - captures external service dependencies.
4
-
5
- **Purpose:** Document what external systems this codebase communicates with. Focused on "what lives outside our code that we depend on."
6
-
7
- ---
8
-
9
- ## File Template
10
-
11
- ```markdown
12
- # External Integrations
13
-
14
- **Analysis Date:** [YYYY-MM-DD]
15
-
16
- ## APIs & External Services
17
-
18
- **Payment Processing:**
19
- - [Service] - [What it's used for: e.g., "subscription billing, one-time payments"]
20
- - SDK/Client: [e.g., "stripe npm package v14.x"]
21
- - Auth: [e.g., "API key in STRIPE_SECRET_KEY env var"]
22
- - Endpoints used: [e.g., "checkout sessions, webhooks"]
23
-
24
- **Email/SMS:**
25
- - [Service] - [What it's used for: e.g., "transactional emails"]
26
- - SDK/Client: [e.g., "sendgrid/mail v8.x"]
27
- - Auth: [e.g., "API key in SENDGRID_API_KEY env var"]
28
- - Templates: [e.g., "managed in SendGrid dashboard"]
29
-
30
- **External APIs:**
31
- - [Service] - [What it's used for]
32
- - Integration method: [e.g., "REST API via fetch", "GraphQL client"]
33
- - Auth: [e.g., "OAuth2 token in AUTH_TOKEN env var"]
34
- - Rate limits: [if applicable]
35
-
36
- ## Data Storage
37
-
38
- **Databases:**
39
- - [Type/Provider] - [e.g., "PostgreSQL on Supabase"]
40
- - Connection: [e.g., "via DATABASE_URL env var"]
41
- - Client: [e.g., "Prisma ORM v5.x"]
42
- - Migrations: [e.g., "prisma migrate in migrations/"]
43
-
44
- **File Storage:**
45
- - [Service] - [e.g., "AWS S3 for user uploads"]
46
- - SDK/Client: [e.g., "@aws-sdk/client-s3"]
47
- - Auth: [e.g., "IAM credentials in AWS_* env vars"]
48
- - Buckets: [e.g., "prod-uploads, dev-uploads"]
49
-
50
- **Caching:**
51
- - [Service] - [e.g., "Redis for session storage"]
52
- - Connection: [e.g., "REDIS_URL env var"]
53
- - Client: [e.g., "ioredis v5.x"]
54
-
55
- ## Authentication & Identity
56
-
57
- **Auth Provider:**
58
- - [Service] - [e.g., "Supabase Auth", "Auth0", "custom JWT"]
59
- - Implementation: [e.g., "Supabase client SDK"]
60
- - Token storage: [e.g., "httpOnly cookies", "localStorage"]
61
- - Session management: [e.g., "JWT refresh tokens"]
62
-
63
- **OAuth Integrations:**
64
- - [Provider] - [e.g., "Google OAuth for sign-in"]
65
- - Credentials: [e.g., "GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET"]
66
- - Scopes: [e.g., "email, profile"]
67
-
68
- ## Monitoring & Observability
69
-
70
- **Error Tracking:**
71
- - [Service] - [e.g., "Sentry"]
72
- - DSN: [e.g., "SENTRY_DSN env var"]
73
- - Release tracking: [e.g., "via SENTRY_RELEASE"]
74
-
75
- **Analytics:**
76
- - [Service] - [e.g., "Mixpanel for product analytics"]
77
- - Token: [e.g., "MIXPANEL_TOKEN env var"]
78
- - Events tracked: [e.g., "user actions, page views"]
79
-
80
- **Logs:**
81
- - [Service] - [e.g., "CloudWatch", "Datadog", "none (stdout only)"]
82
- - Integration: [e.g., "AWS Lambda built-in"]
83
-
84
- ## CI/CD & Deployment
85
-
86
- **Hosting:**
87
- - [Platform] - [e.g., "Vercel", "AWS Lambda", "Docker on ECS"]
88
- - Deployment: [e.g., "automatic on main branch push"]
89
- - Environment vars: [e.g., "configured in Vercel dashboard"]
90
-
91
- **CI Pipeline:**
92
- - [Service] - [e.g., "GitHub Actions"]
93
- - Workflows: [e.g., "test.yml, deploy.yml"]
94
- - Secrets: [e.g., "stored in GitHub repo secrets"]
95
-
96
- ## Environment Configuration
97
-
98
- **Development:**
99
- - Required env vars: [List critical vars]
100
- - Secrets location: [e.g., ".env.local (gitignored)", "1Password vault"]
101
- - Mock/stub services: [e.g., "Stripe test mode", "local PostgreSQL"]
102
-
103
- **Staging:**
104
- - Environment-specific differences: [e.g., "uses staging Stripe account"]
105
- - Data: [e.g., "separate staging database"]
106
-
107
- **Production:**
108
- - Secrets management: [e.g., "Vercel environment variables"]
109
- - Failover/redundancy: [e.g., "multi-region DB replication"]
110
-
111
- ## Webhooks & Callbacks
112
-
113
- **Incoming:**
114
- - [Service] - [Endpoint: e.g., "/api/webhooks/stripe"]
115
- - Verification: [e.g., "signature validation via stripe.webhooks.constructEvent"]
116
- - Events: [e.g., "payment_intent.succeeded, customer.subscription.updated"]
117
-
118
- **Outgoing:**
119
- - [Service] - [What triggers it]
120
- - Endpoint: [e.g., "external CRM webhook on user signup"]
121
- - Retry logic: [if applicable]
122
-
123
- ---
124
-
125
- *Integration audit: [date]*
126
- *Update when adding/removing external services*
127
- ```
128
-
129
- <good_examples>
130
- ```markdown
131
- # External Integrations
132
-
133
- **Analysis Date:** 2025-01-20
134
-
135
- ## APIs & External Services
136
-
137
- **Payment Processing:**
138
- - Stripe - Subscription billing and one-time course payments
139
- - SDK/Client: stripe npm package v14.8
140
- - Auth: API key in STRIPE_SECRET_KEY env var
141
- - Endpoints used: checkout sessions, customer portal, webhooks
142
-
143
- **Email/SMS:**
144
- - SendGrid - Transactional emails (receipts, password resets)
145
- - SDK/Client: @sendgrid/mail v8.1
146
- - Auth: API key in SENDGRID_API_KEY env var
147
- - Templates: Managed in SendGrid dashboard (template IDs in code)
148
-
149
- **External APIs:**
150
- - OpenAI API - Course content generation
151
- - Integration method: REST API via openai npm package v4.x
152
- - Auth: Bearer token in OPENAI_API_KEY env var
153
- - Rate limits: 3500 requests/min (tier 3)
154
-
155
- ## Data Storage
156
-
157
- **Databases:**
158
- - PostgreSQL on Supabase - Primary data store
159
- - Connection: via DATABASE_URL env var
160
- - Client: Prisma ORM v5.8
161
- - Migrations: prisma migrate in prisma/migrations/
162
-
163
- **File Storage:**
164
- - Supabase Storage - User uploads (profile images, course materials)
165
- - SDK/Client: @supabase/supabase-js v2.x
166
- - Auth: Service role key in SUPABASE_SERVICE_ROLE_KEY
167
- - Buckets: avatars (public), course-materials (private)
168
-
169
- **Caching:**
170
- - None currently (all database queries, no Redis)
171
-
172
- ## Authentication & Identity
173
-
174
- **Auth Provider:**
175
- - Supabase Auth - Email/password + OAuth
176
- - Implementation: Supabase client SDK with server-side session management
177
- - Token storage: httpOnly cookies via @supabase/ssr
178
- - Session management: JWT refresh tokens handled by Supabase
179
-
180
- **OAuth Integrations:**
181
- - Google OAuth - Social sign-in
182
- - Credentials: GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET (Supabase dashboard)
183
- - Scopes: email, profile
184
-
185
- ## Monitoring & Observability
186
-
187
- **Error Tracking:**
188
- - Sentry - Server and client errors
189
- - DSN: SENTRY_DSN env var
190
- - Release tracking: Git commit SHA via SENTRY_RELEASE
191
-
192
- **Analytics:**
193
- - None (planned: Mixpanel)
194
-
195
- **Logs:**
196
- - Vercel logs - stdout/stderr only
197
- - Retention: 7 days on Pro plan
198
-
199
- ## CI/CD & Deployment
200
-
201
- **Hosting:**
202
- - Vercel - Next.js app hosting
203
- - Deployment: Automatic on main branch push
204
- - Environment vars: Configured in Vercel dashboard (synced to .env.example)
205
-
206
- **CI Pipeline:**
207
- - GitHub Actions - Tests and type checking
208
- - Workflows: .github/workflows/ci.yml
209
- - Secrets: None needed (public repo tests only)
210
-
211
- ## Environment Configuration
212
-
213
- **Development:**
214
- - Required env vars: DATABASE_URL, NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY
215
- - Secrets location: .env.local (gitignored), team shared via 1Password vault
216
- - Mock/stub services: Stripe test mode, Supabase local dev project
217
-
218
- **Staging:**
219
- - Uses separate Supabase staging project
220
- - Stripe test mode
221
- - Same Vercel account, different environment
222
-
223
- **Production:**
224
- - Secrets management: Vercel environment variables
225
- - Database: Supabase production project with daily backups
226
-
227
- ## Webhooks & Callbacks
228
-
229
- **Incoming:**
230
- - Stripe - /api/webhooks/stripe
231
- - Verification: Signature validation via stripe.webhooks.constructEvent
232
- - Events: payment_intent.succeeded, customer.subscription.updated, customer.subscription.deleted
233
-
234
- **Outgoing:**
235
- - None
236
-
237
- ---
238
-
239
- *Integration audit: 2025-01-20*
240
- *Update when adding/removing external services*
241
- ```
242
- </good_examples>
243
-
244
- <guidelines>
245
- **What belongs in INTEGRATIONS.md:**
246
- - External services the code communicates with
247
- - Authentication patterns (where secrets live, not the secrets themselves)
248
- - SDKs and client libraries used
249
- - Environment variable names (not values)
250
- - Webhook endpoints and verification methods
251
- - Database connection patterns
252
- - File storage locations
253
- - Monitoring and logging services
254
-
255
- **What does NOT belong here:**
256
- - Actual API keys or secrets (NEVER write these)
257
- - Internal architecture (that's ARCHITECTURE.md)
258
- - Code patterns (that's PATTERNS.md)
259
- - Technology choices (that's STACK.md)
260
- - Performance issues (that's CONCERNS.md)
261
-
262
- **When filling this template:**
263
- - Check .env.example or .env.template for required env vars
264
- - Look for SDK imports (stripe, @sendgrid/mail, etc.)
265
- - Check for webhook handlers in routes/endpoints
266
- - Note where secrets are managed (not the secrets)
267
- - Document environment-specific differences (dev/staging/prod)
268
- - Include auth patterns for each service
269
-
270
- **Useful for phase planning when:**
271
- - Adding new external service integrations
272
- - Debugging authentication issues
273
- - Understanding data flow outside the application
274
- - Setting up new environments
275
- - Auditing third-party dependencies
276
- - Planning for service outages or migrations
277
-
278
- **Security note:**
279
- Document WHERE secrets live (env vars, Vercel dashboard, 1Password), never WHAT the secrets are.
280
- </guidelines>
1
+ # External Integrations Template
2
+
3
+ Template for `.planning/codebase/INTEGRATIONS.md` - captures external service dependencies.
4
+
5
+ **Purpose:** Document what external systems this codebase communicates with. Focused on "what lives outside our code that we depend on."
6
+
7
+ ---
8
+
9
+ ## File Template
10
+
11
+ ```markdown
12
+ # External Integrations
13
+
14
+ **Analysis Date:** [YYYY-MM-DD]
15
+
16
+ ## APIs & External Services
17
+
18
+ **Payment Processing:**
19
+ - [Service] - [What it's used for: e.g., "subscription billing, one-time payments"]
20
+ - SDK/Client: [e.g., "stripe npm package v14.x"]
21
+ - Auth: [e.g., "API key in STRIPE_SECRET_KEY env var"]
22
+ - Endpoints used: [e.g., "checkout sessions, webhooks"]
23
+
24
+ **Email/SMS:**
25
+ - [Service] - [What it's used for: e.g., "transactional emails"]
26
+ - SDK/Client: [e.g., "sendgrid/mail v8.x"]
27
+ - Auth: [e.g., "API key in SENDGRID_API_KEY env var"]
28
+ - Templates: [e.g., "managed in SendGrid dashboard"]
29
+
30
+ **External APIs:**
31
+ - [Service] - [What it's used for]
32
+ - Integration method: [e.g., "REST API via fetch", "GraphQL client"]
33
+ - Auth: [e.g., "OAuth2 token in AUTH_TOKEN env var"]
34
+ - Rate limits: [if applicable]
35
+
36
+ ## Data Storage
37
+
38
+ **Databases:**
39
+ - [Type/Provider] - [e.g., "PostgreSQL on Supabase"]
40
+ - Connection: [e.g., "via DATABASE_URL env var"]
41
+ - Client: [e.g., "Prisma ORM v5.x"]
42
+ - Migrations: [e.g., "prisma migrate in migrations/"]
43
+
44
+ **File Storage:**
45
+ - [Service] - [e.g., "AWS S3 for user uploads"]
46
+ - SDK/Client: [e.g., "@aws-sdk/client-s3"]
47
+ - Auth: [e.g., "IAM credentials in AWS_* env vars"]
48
+ - Buckets: [e.g., "prod-uploads, dev-uploads"]
49
+
50
+ **Caching:**
51
+ - [Service] - [e.g., "Redis for session storage"]
52
+ - Connection: [e.g., "REDIS_URL env var"]
53
+ - Client: [e.g., "ioredis v5.x"]
54
+
55
+ ## Authentication & Identity
56
+
57
+ **Auth Provider:**
58
+ - [Service] - [e.g., "Supabase Auth", "Auth0", "custom JWT"]
59
+ - Implementation: [e.g., "Supabase client SDK"]
60
+ - Token storage: [e.g., "httpOnly cookies", "localStorage"]
61
+ - Session management: [e.g., "JWT refresh tokens"]
62
+
63
+ **OAuth Integrations:**
64
+ - [Provider] - [e.g., "Google OAuth for sign-in"]
65
+ - Credentials: [e.g., "GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET"]
66
+ - Scopes: [e.g., "email, profile"]
67
+
68
+ ## Monitoring & Observability
69
+
70
+ **Error Tracking:**
71
+ - [Service] - [e.g., "Sentry"]
72
+ - DSN: [e.g., "SENTRY_DSN env var"]
73
+ - Release tracking: [e.g., "via SENTRY_RELEASE"]
74
+
75
+ **Analytics:**
76
+ - [Service] - [e.g., "Mixpanel for product analytics"]
77
+ - Token: [e.g., "MIXPANEL_TOKEN env var"]
78
+ - Events tracked: [e.g., "user actions, page views"]
79
+
80
+ **Logs:**
81
+ - [Service] - [e.g., "CloudWatch", "Datadog", "none (stdout only)"]
82
+ - Integration: [e.g., "AWS Lambda built-in"]
83
+
84
+ ## CI/CD & Deployment
85
+
86
+ **Hosting:**
87
+ - [Platform] - [e.g., "Vercel", "AWS Lambda", "Docker on ECS"]
88
+ - Deployment: [e.g., "automatic on main branch push"]
89
+ - Environment vars: [e.g., "configured in Vercel dashboard"]
90
+
91
+ **CI Pipeline:**
92
+ - [Service] - [e.g., "GitHub Actions"]
93
+ - Workflows: [e.g., "test.yml, deploy.yml"]
94
+ - Secrets: [e.g., "stored in GitHub repo secrets"]
95
+
96
+ ## Environment Configuration
97
+
98
+ **Development:**
99
+ - Required env vars: [List critical vars]
100
+ - Secrets location: [e.g., ".env.local (gitignored)", "1Password vault"]
101
+ - Mock/stub services: [e.g., "Stripe test mode", "local PostgreSQL"]
102
+
103
+ **Staging:**
104
+ - Environment-specific differences: [e.g., "uses staging Stripe account"]
105
+ - Data: [e.g., "separate staging database"]
106
+
107
+ **Production:**
108
+ - Secrets management: [e.g., "Vercel environment variables"]
109
+ - Failover/redundancy: [e.g., "multi-region DB replication"]
110
+
111
+ ## Webhooks & Callbacks
112
+
113
+ **Incoming:**
114
+ - [Service] - [Endpoint: e.g., "/api/webhooks/stripe"]
115
+ - Verification: [e.g., "signature validation via stripe.webhooks.constructEvent"]
116
+ - Events: [e.g., "payment_intent.succeeded, customer.subscription.updated"]
117
+
118
+ **Outgoing:**
119
+ - [Service] - [What triggers it]
120
+ - Endpoint: [e.g., "external CRM webhook on user signup"]
121
+ - Retry logic: [if applicable]
122
+
123
+ ---
124
+
125
+ *Integration audit: [date]*
126
+ *Update when adding/removing external services*
127
+ ```
128
+
129
+ <good_examples>
130
+ ```markdown
131
+ # External Integrations
132
+
133
+ **Analysis Date:** 2025-01-20
134
+
135
+ ## APIs & External Services
136
+
137
+ **Payment Processing:**
138
+ - Stripe - Subscription billing and one-time course payments
139
+ - SDK/Client: stripe npm package v14.8
140
+ - Auth: API key in STRIPE_SECRET_KEY env var
141
+ - Endpoints used: checkout sessions, customer portal, webhooks
142
+
143
+ **Email/SMS:**
144
+ - SendGrid - Transactional emails (receipts, password resets)
145
+ - SDK/Client: @sendgrid/mail v8.1
146
+ - Auth: API key in SENDGRID_API_KEY env var
147
+ - Templates: Managed in SendGrid dashboard (template IDs in code)
148
+
149
+ **External APIs:**
150
+ - OpenAI API - Course content generation
151
+ - Integration method: REST API via openai npm package v4.x
152
+ - Auth: Bearer token in OPENAI_API_KEY env var
153
+ - Rate limits: 3500 requests/min (tier 3)
154
+
155
+ ## Data Storage
156
+
157
+ **Databases:**
158
+ - PostgreSQL on Supabase - Primary data store
159
+ - Connection: via DATABASE_URL env var
160
+ - Client: Prisma ORM v5.8
161
+ - Migrations: prisma migrate in prisma/migrations/
162
+
163
+ **File Storage:**
164
+ - Supabase Storage - User uploads (profile images, course materials)
165
+ - SDK/Client: @supabase/supabase-js v2.x
166
+ - Auth: Service role key in SUPABASE_SERVICE_ROLE_KEY
167
+ - Buckets: avatars (public), course-materials (private)
168
+
169
+ **Caching:**
170
+ - None currently (all database queries, no Redis)
171
+
172
+ ## Authentication & Identity
173
+
174
+ **Auth Provider:**
175
+ - Supabase Auth - Email/password + OAuth
176
+ - Implementation: Supabase client SDK with server-side session management
177
+ - Token storage: httpOnly cookies via @supabase/ssr
178
+ - Session management: JWT refresh tokens handled by Supabase
179
+
180
+ **OAuth Integrations:**
181
+ - Google OAuth - Social sign-in
182
+ - Credentials: GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET (Supabase dashboard)
183
+ - Scopes: email, profile
184
+
185
+ ## Monitoring & Observability
186
+
187
+ **Error Tracking:**
188
+ - Sentry - Server and client errors
189
+ - DSN: SENTRY_DSN env var
190
+ - Release tracking: Git commit SHA via SENTRY_RELEASE
191
+
192
+ **Analytics:**
193
+ - None (planned: Mixpanel)
194
+
195
+ **Logs:**
196
+ - Vercel logs - stdout/stderr only
197
+ - Retention: 7 days on Pro plan
198
+
199
+ ## CI/CD & Deployment
200
+
201
+ **Hosting:**
202
+ - Vercel - Next.js app hosting
203
+ - Deployment: Automatic on main branch push
204
+ - Environment vars: Configured in Vercel dashboard (synced to .env.example)
205
+
206
+ **CI Pipeline:**
207
+ - GitHub Actions - Tests and type checking
208
+ - Workflows: .github/workflows/ci.yml
209
+ - Secrets: None needed (public repo tests only)
210
+
211
+ ## Environment Configuration
212
+
213
+ **Development:**
214
+ - Required env vars: DATABASE_URL, NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY
215
+ - Secrets location: .env.local (gitignored), team shared via 1Password vault
216
+ - Mock/stub services: Stripe test mode, Supabase local dev project
217
+
218
+ **Staging:**
219
+ - Uses separate Supabase staging project
220
+ - Stripe test mode
221
+ - Same Vercel account, different environment
222
+
223
+ **Production:**
224
+ - Secrets management: Vercel environment variables
225
+ - Database: Supabase production project with daily backups
226
+
227
+ ## Webhooks & Callbacks
228
+
229
+ **Incoming:**
230
+ - Stripe - /api/webhooks/stripe
231
+ - Verification: Signature validation via stripe.webhooks.constructEvent
232
+ - Events: payment_intent.succeeded, customer.subscription.updated, customer.subscription.deleted
233
+
234
+ **Outgoing:**
235
+ - None
236
+
237
+ ---
238
+
239
+ *Integration audit: 2025-01-20*
240
+ *Update when adding/removing external services*
241
+ ```
242
+ </good_examples>
243
+
244
+ <guidelines>
245
+ **What belongs in INTEGRATIONS.md:**
246
+ - External services the code communicates with
247
+ - Authentication patterns (where secrets live, not the secrets themselves)
248
+ - SDKs and client libraries used
249
+ - Environment variable names (not values)
250
+ - Webhook endpoints and verification methods
251
+ - Database connection patterns
252
+ - File storage locations
253
+ - Monitoring and logging services
254
+
255
+ **What does NOT belong here:**
256
+ - Actual API keys or secrets (NEVER write these)
257
+ - Internal architecture (that's ARCHITECTURE.md)
258
+ - Code patterns (that's PATTERNS.md)
259
+ - Technology choices (that's STACK.md)
260
+ - Performance issues (that's CONCERNS.md)
261
+
262
+ **When filling this template:**
263
+ - Check .env.example or .env.template for required env vars
264
+ - Look for SDK imports (stripe, @sendgrid/mail, etc.)
265
+ - Check for webhook handlers in routes/endpoints
266
+ - Note where secrets are managed (not the secrets)
267
+ - Document environment-specific differences (dev/staging/prod)
268
+ - Include auth patterns for each service
269
+
270
+ **Useful for phase planning when:**
271
+ - Adding new external service integrations
272
+ - Debugging authentication issues
273
+ - Understanding data flow outside the application
274
+ - Setting up new environments
275
+ - Auditing third-party dependencies
276
+ - Planning for service outages or migrations
277
+
278
+ **Security note:**
279
+ Document WHERE secrets live (env vars, Vercel dashboard, 1Password), never WHAT the secrets are.
280
+ </guidelines>