@howlil/ez-agents 3.4.1 → 3.5.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 (162) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +84 -20
  3. package/agents/ez-observer-agent.md +260 -0
  4. package/agents/ez-release-agent.md +333 -0
  5. package/agents/ez-requirements-agent.md +377 -0
  6. package/agents/ez-scrum-master-agent.md +242 -0
  7. package/agents/ez-tech-lead-agent.md +267 -0
  8. package/bin/install.js +3221 -3230
  9. package/commands/ez/arch-review.md +102 -0
  10. package/commands/ez/execute-phase.md +11 -0
  11. package/commands/ez/export-session.md +79 -0
  12. package/commands/ez/gather-requirements.md +117 -0
  13. package/commands/ez/git-workflow.md +72 -0
  14. package/commands/ez/hotfix.md +120 -0
  15. package/commands/ez/import-session.md +82 -0
  16. package/commands/ez/join-discord.md +18 -18
  17. package/commands/ez/list-sessions.md +96 -0
  18. package/commands/ez/package-manager.md +316 -0
  19. package/commands/ez/plan-phase.md +9 -1
  20. package/commands/ez/preflight.md +79 -0
  21. package/commands/ez/progress.md +13 -1
  22. package/commands/ez/release.md +153 -0
  23. package/commands/ez/resume.md +107 -0
  24. package/commands/ez/standup.md +85 -0
  25. package/ez-agents/bin/ez-tools.cjs +1095 -716
  26. package/ez-agents/bin/lib/assistant-adapter.cjs +264 -264
  27. package/ez-agents/bin/lib/audit-exec.cjs +7 -2
  28. package/ez-agents/bin/lib/bdd-validator.cjs +622 -0
  29. package/ez-agents/bin/lib/circuit-breaker.cjs +118 -118
  30. package/ez-agents/bin/lib/config.cjs +190 -190
  31. package/ez-agents/bin/lib/content-scanner.cjs +238 -0
  32. package/ez-agents/bin/lib/context-cache.cjs +154 -0
  33. package/ez-agents/bin/lib/context-errors.cjs +71 -0
  34. package/ez-agents/bin/lib/context-manager.cjs +220 -0
  35. package/ez-agents/bin/lib/discussion-synthesizer.cjs +458 -0
  36. package/ez-agents/bin/lib/file-access.cjs +207 -0
  37. package/ez-agents/bin/lib/file-lock.cjs +236 -236
  38. package/ez-agents/bin/lib/frontmatter.cjs +299 -299
  39. package/ez-agents/bin/lib/fs-utils.cjs +153 -153
  40. package/ez-agents/bin/lib/git-errors.cjs +83 -0
  41. package/ez-agents/bin/lib/git-utils.cjs +118 -0
  42. package/ez-agents/bin/lib/git-workflow-engine.cjs +1157 -0
  43. package/ez-agents/bin/lib/index.cjs +157 -113
  44. package/ez-agents/bin/lib/init.cjs +757 -757
  45. package/ez-agents/bin/lib/lockfile-validator.cjs +227 -0
  46. package/ez-agents/bin/lib/logger.cjs +124 -124
  47. package/ez-agents/bin/lib/memory-compression.cjs +256 -0
  48. package/ez-agents/bin/lib/metrics-tracker.cjs +406 -0
  49. package/ez-agents/bin/lib/milestone.cjs +241 -241
  50. package/ez-agents/bin/lib/model-provider.cjs +241 -241
  51. package/ez-agents/bin/lib/package-manager-detector.cjs +203 -0
  52. package/ez-agents/bin/lib/package-manager-executor.cjs +385 -0
  53. package/ez-agents/bin/lib/package-manager-service.cjs +216 -0
  54. package/ez-agents/bin/lib/phase.cjs +925 -925
  55. package/ez-agents/bin/lib/planning-write.cjs +107 -107
  56. package/ez-agents/bin/lib/release-validator.cjs +614 -0
  57. package/ez-agents/bin/lib/retry.cjs +119 -119
  58. package/ez-agents/bin/lib/roadmap.cjs +306 -306
  59. package/ez-agents/bin/lib/safe-exec.cjs +128 -128
  60. package/ez-agents/bin/lib/safe-path.cjs +130 -130
  61. package/ez-agents/bin/lib/session-chain.cjs +304 -0
  62. package/ez-agents/bin/lib/session-errors.cjs +81 -0
  63. package/ez-agents/bin/lib/session-export.cjs +251 -0
  64. package/ez-agents/bin/lib/session-import.cjs +262 -0
  65. package/ez-agents/bin/lib/session-manager.cjs +280 -0
  66. package/ez-agents/bin/lib/state.cjs +736 -736
  67. package/ez-agents/bin/lib/temp-file.cjs +239 -239
  68. package/ez-agents/bin/lib/template.cjs +223 -223
  69. package/ez-agents/bin/lib/test-file-lock.cjs +112 -112
  70. package/ez-agents/bin/lib/test-graceful.cjs +93 -93
  71. package/ez-agents/bin/lib/test-logger.cjs +60 -60
  72. package/ez-agents/bin/lib/test-safe-exec.cjs +38 -38
  73. package/ez-agents/bin/lib/test-safe-path.cjs +33 -33
  74. package/ez-agents/bin/lib/test-temp-file.cjs +125 -125
  75. package/ez-agents/bin/lib/tier-manager.cjs +428 -0
  76. package/ez-agents/bin/lib/timeout-exec.cjs +63 -63
  77. package/ez-agents/bin/lib/url-fetch.cjs +170 -0
  78. package/ez-agents/bin/lib/verify.cjs +15 -1
  79. package/ez-agents/references/checkpoints.md +776 -776
  80. package/ez-agents/references/continuation-format.md +249 -249
  81. package/ez-agents/references/metrics-schema.md +118 -0
  82. package/ez-agents/references/planning-config.md +140 -0
  83. package/ez-agents/references/questioning.md +162 -162
  84. package/ez-agents/references/tdd.md +263 -263
  85. package/ez-agents/references/tier-strategy.md +103 -0
  86. package/ez-agents/templates/bdd-feature.md +173 -0
  87. package/ez-agents/templates/codebase/concerns.md +310 -310
  88. package/ez-agents/templates/codebase/conventions.md +307 -307
  89. package/ez-agents/templates/codebase/integrations.md +280 -280
  90. package/ez-agents/templates/codebase/stack.md +186 -186
  91. package/ez-agents/templates/codebase/testing.md +480 -480
  92. package/ez-agents/templates/config.json +37 -37
  93. package/ez-agents/templates/continue-here.md +78 -78
  94. package/ez-agents/templates/discussion.md +68 -0
  95. package/ez-agents/templates/incident-runbook.md +205 -0
  96. package/ez-agents/templates/milestone-archive.md +123 -123
  97. package/ez-agents/templates/milestone.md +115 -115
  98. package/ez-agents/templates/release-checklist.md +133 -0
  99. package/ez-agents/templates/requirements.md +231 -231
  100. package/ez-agents/templates/research-project/ARCHITECTURE.md +204 -204
  101. package/ez-agents/templates/research-project/FEATURES.md +147 -147
  102. package/ez-agents/templates/research-project/PITFALLS.md +200 -200
  103. package/ez-agents/templates/research-project/STACK.md +120 -120
  104. package/ez-agents/templates/research-project/SUMMARY.md +170 -170
  105. package/ez-agents/templates/retrospective.md +54 -54
  106. package/ez-agents/templates/roadmap.md +202 -202
  107. package/ez-agents/templates/rollback-plan.md +201 -0
  108. package/ez-agents/templates/summary-minimal.md +41 -41
  109. package/ez-agents/templates/summary-standard.md +48 -48
  110. package/ez-agents/templates/summary.md +248 -248
  111. package/ez-agents/templates/user-setup.md +311 -311
  112. package/ez-agents/templates/verification-report.md +322 -322
  113. package/ez-agents/workflows/add-phase.md +112 -112
  114. package/ez-agents/workflows/add-tests.md +351 -351
  115. package/ez-agents/workflows/add-todo.md +158 -158
  116. package/ez-agents/workflows/arch-review.md +54 -0
  117. package/ez-agents/workflows/audit-milestone.md +332 -332
  118. package/ez-agents/workflows/autonomous.md +131 -30
  119. package/ez-agents/workflows/check-todos.md +177 -177
  120. package/ez-agents/workflows/cleanup.md +152 -152
  121. package/ez-agents/workflows/complete-milestone.md +766 -766
  122. package/ez-agents/workflows/diagnose-issues.md +219 -219
  123. package/ez-agents/workflows/discovery-phase.md +289 -289
  124. package/ez-agents/workflows/discuss-phase.md +762 -762
  125. package/ez-agents/workflows/execute-phase.md +513 -468
  126. package/ez-agents/workflows/execute-plan.md +483 -483
  127. package/ez-agents/workflows/export-session.md +255 -0
  128. package/ez-agents/workflows/gather-requirements.md +206 -0
  129. package/ez-agents/workflows/health.md +159 -159
  130. package/ez-agents/workflows/help.md +584 -492
  131. package/ez-agents/workflows/hotfix.md +291 -0
  132. package/ez-agents/workflows/import-session.md +303 -0
  133. package/ez-agents/workflows/insert-phase.md +130 -130
  134. package/ez-agents/workflows/list-phase-assumptions.md +178 -178
  135. package/ez-agents/workflows/map-codebase.md +316 -316
  136. package/ez-agents/workflows/new-milestone.md +339 -10
  137. package/ez-agents/workflows/new-project.md +293 -299
  138. package/ez-agents/workflows/node-repair.md +92 -92
  139. package/ez-agents/workflows/pause-work.md +122 -122
  140. package/ez-agents/workflows/plan-milestone-gaps.md +274 -274
  141. package/ez-agents/workflows/plan-phase.md +673 -651
  142. package/ez-agents/workflows/progress.md +372 -382
  143. package/ez-agents/workflows/quick.md +610 -610
  144. package/ez-agents/workflows/release.md +253 -0
  145. package/ez-agents/workflows/remove-phase.md +155 -155
  146. package/ez-agents/workflows/research-phase.md +74 -74
  147. package/ez-agents/workflows/resume-project.md +307 -307
  148. package/ez-agents/workflows/resume-session.md +215 -0
  149. package/ez-agents/workflows/set-profile.md +81 -81
  150. package/ez-agents/workflows/settings.md +242 -242
  151. package/ez-agents/workflows/standup.md +64 -0
  152. package/ez-agents/workflows/stats.md +57 -57
  153. package/ez-agents/workflows/transition.md +544 -544
  154. package/ez-agents/workflows/ui-phase.md +290 -290
  155. package/ez-agents/workflows/ui-review.md +157 -157
  156. package/ez-agents/workflows/update.md +320 -320
  157. package/ez-agents/workflows/validate-phase.md +167 -167
  158. package/ez-agents/workflows/verify-phase.md +243 -243
  159. package/ez-agents/workflows/verify-work.md +584 -584
  160. package/package.json +10 -4
  161. package/scripts/build-hooks.js +43 -43
  162. 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>