@prmichaelsen/acp-visualizer 0.1.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 (180) hide show
  1. package/README.md +68 -0
  2. package/agent/commands/acp.clarification-address.md +417 -0
  3. package/agent/commands/acp.clarification-capture.md +386 -0
  4. package/agent/commands/acp.clarification-create.md +437 -0
  5. package/agent/commands/acp.clarifications-research.md +326 -0
  6. package/agent/commands/acp.command-create.md +432 -0
  7. package/agent/commands/acp.design-create.md +286 -0
  8. package/agent/commands/acp.design-reference.md +355 -0
  9. package/agent/commands/acp.handoff.md +270 -0
  10. package/agent/commands/acp.index.md +423 -0
  11. package/agent/commands/acp.init.md +546 -0
  12. package/agent/commands/acp.package-create.md +895 -0
  13. package/agent/commands/acp.package-info.md +212 -0
  14. package/agent/commands/acp.package-install.md +539 -0
  15. package/agent/commands/acp.package-list.md +280 -0
  16. package/agent/commands/acp.package-publish.md +541 -0
  17. package/agent/commands/acp.package-remove.md +293 -0
  18. package/agent/commands/acp.package-search.md +307 -0
  19. package/agent/commands/acp.package-update.md +361 -0
  20. package/agent/commands/acp.package-validate.md +540 -0
  21. package/agent/commands/acp.pattern-create.md +386 -0
  22. package/agent/commands/acp.plan.md +587 -0
  23. package/agent/commands/acp.proceed.md +882 -0
  24. package/agent/commands/acp.project-create.md +675 -0
  25. package/agent/commands/acp.project-info.md +312 -0
  26. package/agent/commands/acp.project-list.md +226 -0
  27. package/agent/commands/acp.project-remove.md +379 -0
  28. package/agent/commands/acp.project-set.md +227 -0
  29. package/agent/commands/acp.project-update.md +307 -0
  30. package/agent/commands/acp.projects-restore.md +228 -0
  31. package/agent/commands/acp.projects-sync.md +347 -0
  32. package/agent/commands/acp.report.md +407 -0
  33. package/agent/commands/acp.resume.md +239 -0
  34. package/agent/commands/acp.sessions.md +301 -0
  35. package/agent/commands/acp.status.md +293 -0
  36. package/agent/commands/acp.sync.md +364 -0
  37. package/agent/commands/acp.task-create.md +500 -0
  38. package/agent/commands/acp.update.md +302 -0
  39. package/agent/commands/acp.validate.md +466 -0
  40. package/agent/commands/acp.version-check-for-updates.md +276 -0
  41. package/agent/commands/acp.version-check.md +191 -0
  42. package/agent/commands/acp.version-update.md +289 -0
  43. package/agent/commands/command.template.md +339 -0
  44. package/agent/commands/git.commit.md +526 -0
  45. package/agent/commands/git.init.md +514 -0
  46. package/agent/commands/tanstack-cloudflare.deploy.md +272 -0
  47. package/agent/commands/tanstack-cloudflare.tail.md +275 -0
  48. package/agent/design/.gitkeep +0 -0
  49. package/agent/design/design.template.md +154 -0
  50. package/agent/design/local.dashboard-layout-routing.md +288 -0
  51. package/agent/design/local.data-model-yaml-parsing.md +310 -0
  52. package/agent/design/local.search-filtering.md +331 -0
  53. package/agent/design/local.server-api-auto-refresh.md +235 -0
  54. package/agent/design/local.table-tree-views.md +299 -0
  55. package/agent/design/local.visualizer-requirements.md +349 -0
  56. package/agent/design/requirements.template.md +387 -0
  57. package/agent/index/.gitkeep +0 -0
  58. package/agent/index/acp.core.yaml +137 -0
  59. package/agent/index/local.main.template.yaml +37 -0
  60. package/agent/manifest.template.yaml +13 -0
  61. package/agent/manifest.yaml +302 -0
  62. package/agent/milestones/.gitkeep +0 -0
  63. package/agent/milestones/milestone-1-project-scaffold-data-pipeline.md +67 -0
  64. package/agent/milestones/milestone-1-{title}.template.md +206 -0
  65. package/agent/milestones/milestone-2-dashboard-views-interaction.md +79 -0
  66. package/agent/package.template.yaml +86 -0
  67. package/agent/patterns/.gitkeep +0 -0
  68. package/agent/patterns/bootstrap.template.md +1237 -0
  69. package/agent/patterns/pattern.template.md +382 -0
  70. package/agent/patterns/tanstack-cloudflare.acl-permissions.md +332 -0
  71. package/agent/patterns/tanstack-cloudflare.action-bar-item.md +416 -0
  72. package/agent/patterns/tanstack-cloudflare.api-route-handlers.md +401 -0
  73. package/agent/patterns/tanstack-cloudflare.auth-session-management.md +387 -0
  74. package/agent/patterns/tanstack-cloudflare.card-and-list.md +271 -0
  75. package/agent/patterns/tanstack-cloudflare.chat-engine.md +353 -0
  76. package/agent/patterns/tanstack-cloudflare.confirmation-tokens.md +346 -0
  77. package/agent/patterns/tanstack-cloudflare.durable-objects-websocket.md +516 -0
  78. package/agent/patterns/tanstack-cloudflare.email-service.md +431 -0
  79. package/agent/patterns/tanstack-cloudflare.expander.md +98 -0
  80. package/agent/patterns/tanstack-cloudflare.fcm-push.md +115 -0
  81. package/agent/patterns/tanstack-cloudflare.firebase-anonymous-sessions.md +441 -0
  82. package/agent/patterns/tanstack-cloudflare.firebase-auth.md +348 -0
  83. package/agent/patterns/tanstack-cloudflare.firebase-firestore.md +550 -0
  84. package/agent/patterns/tanstack-cloudflare.firebase-storage.md +369 -0
  85. package/agent/patterns/tanstack-cloudflare.form-controls.md +145 -0
  86. package/agent/patterns/tanstack-cloudflare.global-search-context.md +93 -0
  87. package/agent/patterns/tanstack-cloudflare.image-carousel.md +126 -0
  88. package/agent/patterns/tanstack-cloudflare.library-services.md +553 -0
  89. package/agent/patterns/tanstack-cloudflare.lightbox.md +169 -0
  90. package/agent/patterns/tanstack-cloudflare.markdown-content.md +115 -0
  91. package/agent/patterns/tanstack-cloudflare.mention-suggestions.md +98 -0
  92. package/agent/patterns/tanstack-cloudflare.modal.md +156 -0
  93. package/agent/patterns/tanstack-cloudflare.nextjs-to-tanstack-routing.md +461 -0
  94. package/agent/patterns/tanstack-cloudflare.notifications-engine.md +151 -0
  95. package/agent/patterns/tanstack-cloudflare.oauth-token-refresh.md +90 -0
  96. package/agent/patterns/tanstack-cloudflare.og-metadata.md +296 -0
  97. package/agent/patterns/tanstack-cloudflare.pagination.md +442 -0
  98. package/agent/patterns/tanstack-cloudflare.pill-input.md +220 -0
  99. package/agent/patterns/tanstack-cloudflare.provider-adapter.md +401 -0
  100. package/agent/patterns/tanstack-cloudflare.rate-limiting.md +323 -0
  101. package/agent/patterns/tanstack-cloudflare.scheduled-tasks.md +338 -0
  102. package/agent/patterns/tanstack-cloudflare.searchable-settings.md +375 -0
  103. package/agent/patterns/tanstack-cloudflare.slide-over.md +129 -0
  104. package/agent/patterns/tanstack-cloudflare.ssr-preload.md +571 -0
  105. package/agent/patterns/tanstack-cloudflare.third-party-api-integration.md +508 -0
  106. package/agent/patterns/tanstack-cloudflare.toast-system.md +142 -0
  107. package/agent/patterns/tanstack-cloudflare.unified-header.md +280 -0
  108. package/agent/patterns/tanstack-cloudflare.user-scoped-collections.md +628 -0
  109. package/agent/patterns/tanstack-cloudflare.websocket-manager.md +237 -0
  110. package/agent/patterns/tanstack-cloudflare.wrangler-configuration.md +358 -0
  111. package/agent/patterns/tanstack-cloudflare.zod-schema-validation.md +336 -0
  112. package/agent/progress.template.yaml +161 -0
  113. package/agent/progress.yaml +145 -0
  114. package/agent/schemas/package.schema.yaml +276 -0
  115. package/agent/scripts/acp.common.sh +1781 -0
  116. package/agent/scripts/acp.install.sh +333 -0
  117. package/agent/scripts/acp.package-create.sh +924 -0
  118. package/agent/scripts/acp.package-info.sh +288 -0
  119. package/agent/scripts/acp.package-install.sh +893 -0
  120. package/agent/scripts/acp.package-list.sh +311 -0
  121. package/agent/scripts/acp.package-publish.sh +420 -0
  122. package/agent/scripts/acp.package-remove.sh +348 -0
  123. package/agent/scripts/acp.package-search.sh +156 -0
  124. package/agent/scripts/acp.package-update.sh +517 -0
  125. package/agent/scripts/acp.package-validate.sh +1018 -0
  126. package/agent/scripts/acp.uninstall.sh +85 -0
  127. package/agent/scripts/acp.version-check-for-updates.sh +98 -0
  128. package/agent/scripts/acp.version-check.sh +47 -0
  129. package/agent/scripts/acp.version-update.sh +176 -0
  130. package/agent/scripts/acp.yaml-parser.sh +985 -0
  131. package/agent/scripts/acp.yaml-validate.sh +205 -0
  132. package/agent/tasks/.gitkeep +0 -0
  133. package/agent/tasks/milestone-1-project-scaffold-data-pipeline/task-1-initialize-tanstack-start-project.md +210 -0
  134. package/agent/tasks/milestone-1-project-scaffold-data-pipeline/task-2-implement-data-model-yaml-parser.md +294 -0
  135. package/agent/tasks/milestone-1-project-scaffold-data-pipeline/task-3-build-server-api-data-loading.md +193 -0
  136. package/agent/tasks/milestone-1-project-scaffold-data-pipeline/task-4-add-auto-refresh-sse.md +262 -0
  137. package/agent/tasks/milestone-2-dashboard-views-interaction/task-10-polish-integration-testing.md +156 -0
  138. package/agent/tasks/milestone-2-dashboard-views-interaction/task-5-build-dashboard-layout-routing.md +178 -0
  139. package/agent/tasks/milestone-2-dashboard-views-interaction/task-6-build-overview-page.md +141 -0
  140. package/agent/tasks/milestone-2-dashboard-views-interaction/task-7-implement-milestone-table-view.md +153 -0
  141. package/agent/tasks/milestone-2-dashboard-views-interaction/task-8-implement-milestone-tree-view.md +174 -0
  142. package/agent/tasks/milestone-2-dashboard-views-interaction/task-9-implement-search-filtering.md +233 -0
  143. package/agent/tasks/task-1-{title}.template.md +244 -0
  144. package/bin/visualize.mjs +84 -0
  145. package/package.json +48 -0
  146. package/src/components/ExtraFieldsBadge.tsx +15 -0
  147. package/src/components/FilterBar.tsx +33 -0
  148. package/src/components/Header.tsx +23 -0
  149. package/src/components/MilestoneTable.tsx +167 -0
  150. package/src/components/MilestoneTree.tsx +84 -0
  151. package/src/components/ProgressBar.tsx +20 -0
  152. package/src/components/SearchInput.tsx +22 -0
  153. package/src/components/Sidebar.tsx +54 -0
  154. package/src/components/StatusBadge.tsx +23 -0
  155. package/src/components/StatusDot.tsx +12 -0
  156. package/src/components/TaskList.tsx +36 -0
  157. package/src/components/ViewToggle.tsx +31 -0
  158. package/src/lib/config.ts +8 -0
  159. package/src/lib/file-watcher.ts +43 -0
  160. package/src/lib/search.ts +48 -0
  161. package/src/lib/types.ts +73 -0
  162. package/src/lib/useAutoRefresh.ts +31 -0
  163. package/src/lib/useCollapse.ts +31 -0
  164. package/src/lib/useFilteredData.ts +55 -0
  165. package/src/lib/yaml-loader-real.spec.ts +47 -0
  166. package/src/lib/yaml-loader.spec.ts +201 -0
  167. package/src/lib/yaml-loader.ts +265 -0
  168. package/src/routeTree.gen.ts +140 -0
  169. package/src/router.tsx +10 -0
  170. package/src/routes/__root.tsx +75 -0
  171. package/src/routes/api/watch.ts +29 -0
  172. package/src/routes/index.tsx +115 -0
  173. package/src/routes/milestones.tsx +50 -0
  174. package/src/routes/search.tsx +84 -0
  175. package/src/routes/tasks.tsx +63 -0
  176. package/src/services/progress-database.service.ts +46 -0
  177. package/src/styles.css +25 -0
  178. package/tsconfig.json +24 -0
  179. package/vite.config.ts +16 -0
  180. package/vitest.config.ts +27 -0
@@ -0,0 +1,272 @@
1
+ # Command: deploy
2
+
3
+ > **🤖 Agent Directive**: If you are reading this file, the command `@tanstack-cloudflare.deploy` has been invoked. Follow the steps below to execute this command.
4
+
5
+ **Namespace**: tanstack-cloudflare
6
+ **Version**: 1.0.0
7
+ **Created**: 2026-02-21
8
+ **Last Updated**: 2026-02-21
9
+ **Status**: Active
10
+
11
+ ---
12
+
13
+ **Purpose**: Build and deploy TanStack Start application to Cloudflare Workers using local environment configuration
14
+ **Category**: Workflow
15
+ **Frequency**: As Needed
16
+
17
+ ---
18
+
19
+ ## What This Command Does
20
+
21
+ This command performs a complete build and deployment cycle for TanStack Start applications to Cloudflare Workers. It builds the application using Vite, sources the local Cloudflare environment variables, and deploys using Wrangler CLI.
22
+
23
+ Use this command when you want to deploy changes to your Cloudflare Workers environment. It's particularly useful during development when you need to test changes in the actual Cloudflare environment rather than local development.
24
+
25
+ The command ensures that the correct environment variables are loaded from `.env.cloudflare.local` before deployment, preventing accidental use of wrong credentials or configuration.
26
+
27
+ ---
28
+
29
+ ## Prerequisites
30
+
31
+ - [ ] Node.js and npm installed
32
+ - [ ] Wrangler CLI installed (`npm install -g wrangler`)
33
+ - [ ] Cloudflare account configured (`wrangler login`)
34
+ - [ ] `.env.cloudflare.local` file exists with required variables
35
+ - [ ] Application code is ready to deploy (no syntax errors)
36
+ - [ ] TanStack Start project properly configured
37
+
38
+ ---
39
+
40
+ ## Steps
41
+
42
+ ### 1. Build Application
43
+
44
+ Build the application for production using Vite.
45
+
46
+ **Actions**:
47
+ - Run `npm run build`
48
+ - Wait for build to complete
49
+ - Verify no build errors
50
+
51
+ **Expected Outcome**: Build completes successfully, `dist/` directory created
52
+
53
+ **Example**:
54
+ ```bash
55
+ npm run build
56
+ ```
57
+
58
+ ### 2. Deploy to Cloudflare Workers
59
+
60
+ Export environment variables and deploy in a single command.
61
+
62
+ **Actions**:
63
+ - Export variables from `.env.cloudflare.local` and run `wrangler deploy` in one command
64
+ - Environment variables loaded and immediately used for deployment
65
+ - Wait for deployment to complete
66
+ - Verify deployment success
67
+ - Note the deployed URL
68
+
69
+ **Expected Outcome**: Application deployed successfully to Cloudflare Workers
70
+
71
+ **Example**:
72
+ ```bash
73
+ export $(cat .env.cloudflare.local | xargs) && wrangler deploy
74
+ ```
75
+
76
+ **Note**: This command reads the env file, exports all variables, and runs wrangler in the same shell session. The `&&` ensures wrangler only runs if export succeeds.
77
+
78
+ ### 3. Verify Deployment
79
+
80
+ Confirm the deployment was successful.
81
+
82
+ **Actions**:
83
+ - Check wrangler output for deployment URL
84
+ - Verify no deployment errors
85
+ - Note the worker version/deployment ID
86
+
87
+ **Expected Outcome**: Deployment URL displayed, no errors
88
+
89
+ ---
90
+
91
+ ## Verification
92
+
93
+ - [ ] Build completed without errors
94
+ - [ ] Environment variables sourced successfully
95
+ - [ ] Wrangler deployment completed
96
+ - [ ] Deployment URL displayed
97
+ - [ ] No error messages in output
98
+ - [ ] Application accessible at deployment URL
99
+
100
+ ---
101
+
102
+ ## Expected Output
103
+
104
+ ### Files Modified
105
+ None - this is a deployment command (reads files, doesn't modify them)
106
+
107
+ ### Console Output
108
+ ```
109
+ > build
110
+ > vite build
111
+
112
+ vite v7.3.1 building client environment for production...
113
+ ✓ 2126 modules transformed.
114
+ ✓ built in 6.60s
115
+
116
+ vite v7.3.1 building ssr environment for production...
117
+ ✓ 5861 modules transformed.
118
+ ✓ built in 12.07s
119
+
120
+ ⛅️ wrangler 3.x.x
121
+ -------------------
122
+ Total Upload: xx.xx KiB / gzip: xx.xx KiB
123
+ Uploaded your-app (x.xx sec)
124
+ Published your-app (x.xx sec)
125
+ https://your-app.your-subdomain.workers.dev
126
+ Current Deployment ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
127
+ ```
128
+
129
+ ### Status Update
130
+ - Application built successfully
131
+ - Deployed to Cloudflare Workers
132
+ - Accessible at deployment URL
133
+
134
+ ---
135
+
136
+ ## Examples
137
+
138
+ ### Example 1: Deploy After Feature Implementation
139
+
140
+ **Context**: Just completed implementing a new feature and want to test in production
141
+
142
+ **Invocation**: `@tanstack-cloudflare.deploy`
143
+
144
+ **Result**: Application builds, environment variables loaded, deployed to Cloudflare Workers, deployment URL displayed
145
+
146
+ ### Example 2: Deploy After Bug Fix
147
+
148
+ **Context**: Fixed a critical bug and need to deploy immediately
149
+
150
+ **Invocation**: `@tanstack-cloudflare.deploy`
151
+
152
+ **Result**: Quick build and deployment cycle, bug fix live in production
153
+
154
+ ### Example 3: Deploy for Testing
155
+
156
+ **Context**: Need to test WebSocket functionality in actual Cloudflare environment
157
+
158
+ **Invocation**: `@tanstack-cloudflare.deploy`
159
+
160
+ **Result**: Application deployed with latest changes, can test real-world behavior
161
+
162
+ ---
163
+
164
+ ## Related Commands
165
+
166
+ - [`@git.commit`](git.commit.md) - Commit changes before deploying
167
+ - [`@acp.status`](acp.status.md) - Check project status before deploying
168
+
169
+ ---
170
+
171
+ ## Troubleshooting
172
+
173
+ ### Issue 1: Build fails with TypeScript errors
174
+
175
+ **Symptom**: `npm run build` fails with TypeScript compilation errors
176
+
177
+ **Cause**: Type errors in source code
178
+
179
+ **Solution**: Fix TypeScript errors before deploying. Run `npm run typecheck` to see all errors.
180
+
181
+ ### Issue 2: Environment file not found
182
+
183
+ **Symptom**: Error "No such file or directory: .env.cloudflare.local"
184
+
185
+ **Cause**: `.env.cloudflare.local` file doesn't exist
186
+
187
+ **Solution**: Create `.env.cloudflare.local` file with required Cloudflare variables. Copy from `.env.example` if available.
188
+
189
+ ### Issue 3: Wrangler authentication error
190
+
191
+ **Symptom**: "Not authenticated" or "Invalid API token"
192
+
193
+ **Cause**: Not logged in to Wrangler or token expired
194
+
195
+ **Solution**: Run `wrangler login` to authenticate with Cloudflare account
196
+
197
+ ### Issue 4: Deployment fails with "Script too large"
198
+
199
+ **Symptom**: Error about worker script size exceeding limits
200
+
201
+ **Cause**: Bundle size too large for Cloudflare Workers free tier
202
+
203
+ **Solution**:
204
+ - Optimize bundle size with code splitting
205
+ - Remove unused dependencies
206
+ - Consider upgrading to Workers Paid plan
207
+ - Use dynamic imports for large dependencies
208
+
209
+ ### Issue 5: Environment variables not loaded
210
+
211
+ **Symptom**: Deployment succeeds but application doesn't work correctly
212
+
213
+ **Cause**: Environment variables not properly sourced or wrong file used
214
+
215
+ **Solution**: Verify `.env.cloudflare.local` exists and contains correct variables. Ensure you're using `export $(cat .env.cloudflare.local | xargs) && wrangler deploy` (single command with &&).
216
+
217
+ ### Issue 6: TanStack Start build errors
218
+
219
+ **Symptom**: Build fails with TanStack-specific errors
220
+
221
+ **Cause**: Misconfigured TanStack Start project or incompatible dependencies
222
+
223
+ **Solution**:
224
+ - Check `app.config.ts` is properly configured
225
+ - Verify `@tanstack/start` version compatibility
226
+ - Review TanStack Start documentation for breaking changes
227
+
228
+ ---
229
+
230
+ ## Security Considerations
231
+
232
+ ### File Access
233
+ - **Reads**: All source files in `src/`, `dist/` directory after build, `.env.cloudflare.local`
234
+ - **Writes**: `dist/` directory (build output)
235
+ - **Executes**: `npm run build`, `wrangler deploy`
236
+
237
+ ### Network Access
238
+ - **APIs**: Cloudflare API (for deployment)
239
+ - **Repositories**: None
240
+
241
+ ### Sensitive Data
242
+ - **Secrets**: Sources `.env.cloudflare.local` which may contain API tokens
243
+ - **Credentials**: Wrangler uses stored Cloudflare credentials
244
+ - **⚠️ Warning**: Never commit `.env.cloudflare.local` to version control
245
+ - **⚠️ Warning**: Ensure `.env.cloudflare.local` is in `.gitignore`
246
+
247
+ ---
248
+
249
+ ## Notes
250
+
251
+ - This command is for local development/testing deployments
252
+ - For production deployments, use CI/CD pipeline
253
+ - Always test locally before deploying (`npm run dev`)
254
+ - Deployment typically takes 15-30 seconds
255
+ - Old deployments are automatically replaced (not versioned)
256
+ - Use `wrangler deployments list` to see deployment history
257
+ - Use `wrangler rollback` to revert to previous deployment if needed
258
+ - The environment variables must be sourced in the same command as wrangler deploy (using `&&`)
259
+ - If deployment fails, check wrangler logs with `wrangler tail`
260
+ - TanStack Start builds both client and SSR bundles - both are deployed
261
+ - Cloudflare Workers have a 1MB compressed size limit for free tier
262
+
263
+ ---
264
+
265
+ **Namespace**: tanstack-cloudflare
266
+ **Command**: deploy
267
+ **Version**: 1.0.0
268
+ **Created**: 2026-02-21
269
+ **Last Updated**: 2026-02-21
270
+ **Status**: Active
271
+ **Compatibility**: TanStack Start, Cloudflare Workers, Wrangler 3.x+
272
+ **Author**: Patrick Michaelsen
@@ -0,0 +1,275 @@
1
+ # Command: tail
2
+
3
+ > **🤖 Agent Directive**: If you are reading this file, the command `@tanstack-cloudflare.tail` has been invoked. Follow the steps below to execute this command.
4
+
5
+ **Namespace**: tanstack-cloudflare
6
+ **Version**: 1.0.0
7
+ **Created**: 2026-02-21
8
+ **Last Updated**: 2026-02-21
9
+ **Status**: Active
10
+
11
+ ---
12
+
13
+ **Purpose**: Stream real-time logs from deployed TanStack Start application on Cloudflare Workers
14
+ **Category**: Debugging
15
+ **Frequency**: As Needed
16
+
17
+ ---
18
+
19
+ ## What This Command Does
20
+
21
+ This command streams real-time logs from your deployed TanStack Start application on Cloudflare Workers using Wrangler's tail functionality. It shows console.log statements, errors, and request information as they happen in production.
22
+
23
+ Use this command when you need to debug production issues, monitor application behavior, or verify that deployed changes are working correctly. It's particularly useful after deployment to confirm everything is functioning as expected.
24
+
25
+ The command loads environment variables from `.env.cloudflare.local` to authenticate with Cloudflare, then starts streaming logs from your worker.
26
+
27
+ ---
28
+
29
+ ## Prerequisites
30
+
31
+ - [ ] Node.js and npm installed
32
+ - [ ] Wrangler CLI installed (`npm install -g wrangler`)
33
+ - [ ] Cloudflare account configured (`wrangler login`)
34
+ - [ ] `.env.cloudflare.local` file exists with required variables
35
+ - [ ] TanStack Start application deployed to Cloudflare Workers
36
+
37
+ ---
38
+
39
+ ## Steps
40
+
41
+ ### 1. Stream Worker Logs
42
+
43
+ Export environment variables and start tailing logs in a single command.
44
+
45
+ **Actions**:
46
+ - Export variables from `.env.cloudflare.local`
47
+ - Run `wrangler tail` to stream logs
48
+ - Watch for console.log statements, errors, and requests
49
+ - Press Ctrl+C to stop tailing
50
+
51
+ **Expected Outcome**: Real-time logs streaming from deployed worker
52
+
53
+ **Example**:
54
+ ```bash
55
+ export $(cat .env.cloudflare.local | xargs) && wrangler tail
56
+ ```
57
+
58
+ **Note**: This command will run continuously until you stop it with Ctrl+C. The logs will show all console.log, console.error, and console.warn statements from your worker, plus request information.
59
+
60
+ ### 2. Monitor Logs
61
+
62
+ Watch the streaming logs for relevant information.
63
+
64
+ **Actions**:
65
+ - Look for console.log statements from your code
66
+ - Watch for errors or warnings
67
+ - Monitor request patterns
68
+ - Check SSR rendering logs
69
+ - Observe API route handling
70
+ - Monitor beforeLoad execution
71
+
72
+ **Expected Outcome**: Real-time visibility into worker behavior
73
+
74
+ ### 3. Stop Tailing
75
+
76
+ Stop the log stream when done.
77
+
78
+ **Actions**:
79
+ - Press Ctrl+C to stop tailing
80
+ - Logs stop streaming
81
+
82
+ **Expected Outcome**: Command exits cleanly
83
+
84
+ ---
85
+
86
+ ## Verification
87
+
88
+ - [ ] Environment variables loaded successfully
89
+ - [ ] Wrangler tail started without errors
90
+ - [ ] Logs are streaming in real-time
91
+ - [ ] Can see console.log statements from worker
92
+ - [ ] Can see SSR rendering logs
93
+ - [ ] Can see API route logs
94
+ - [ ] Can stop tailing with Ctrl+C
95
+
96
+ ---
97
+
98
+ ## Expected Output
99
+
100
+ ### Files Modified
101
+ None - this is a read-only monitoring command
102
+
103
+ ### Console Output
104
+ ```
105
+ ⛅️ wrangler 4.x.x
106
+ ─────────────────────────────────────────────
107
+ Tailing logs for your-app...
108
+
109
+ [2026-02-21 05:20:00] GET https://your-app.workers.dev/
110
+ [2026-02-21 05:20:00] [SSR] Rendering route: /
111
+ [2026-02-21 05:20:00] [beforeLoad] Fetching user session
112
+ [2026-02-21 05:20:01] [DatabaseService] getUserData: user123
113
+ [2026-02-21 05:20:01] [SSR] Route rendered successfully
114
+ [2026-02-21 05:20:05] GET https://your-app.workers.dev/api/data
115
+ [2026-02-21 05:20:05] [API] /api/data - Processing request
116
+ [2026-02-21 05:20:05] [DatabaseService] Query completed in 45ms
117
+ [2026-02-21 05:20:05] [API] /api/data - Response sent (200)
118
+
119
+ ^C (Press Ctrl+C to stop)
120
+ ```
121
+
122
+ ### Status Update
123
+ - Monitoring production logs in real-time
124
+ - Can see all console.log/error/warn statements
125
+ - Can observe request patterns and performance
126
+ - Can debug SSR issues
127
+ - Can monitor API route behavior
128
+
129
+ ---
130
+
131
+ ## Examples
132
+
133
+ ### Example 1: Debug SSR Issue
134
+
135
+ **Context**: Users reporting blank pages, need to see SSR rendering logs
136
+
137
+ **Invocation**: `@tanstack-cloudflare.tail`
138
+
139
+ **Result**: Stream logs, see SSR errors, identify which route is failing
140
+
141
+ ### Example 2: Verify Deployment
142
+
143
+ **Context**: Just deployed new feature, want to confirm it's working
144
+
145
+ **Invocation**: `@tanstack-cloudflare.tail`
146
+
147
+ **Result**: Watch logs as you test the feature, see console.log statements confirming behavior
148
+
149
+ ### Example 3: Monitor API Performance
150
+
151
+ **Context**: Want to see how long database queries take in production
152
+
153
+ **Invocation**: `@tanstack-cloudflare.tail`
154
+
155
+ **Result**: See timing logs from database services, identify slow queries
156
+
157
+ ### Example 4: Debug beforeLoad Issues
158
+
159
+ **Context**: Data not loading on SSR, need to see beforeLoad execution
160
+
161
+ **Invocation**: `@tanstack-cloudflare.tail`
162
+
163
+ **Result**: See beforeLoad logs, identify data fetching issues
164
+
165
+ ---
166
+
167
+ ## Related Commands
168
+
169
+ - [`@tanstack-cloudflare.deploy`](tanstack-cloudflare.deploy.md) - Deploy before tailing logs
170
+ - [`@git.commit`](git.commit.md) - Commit changes before deploying
171
+
172
+ ---
173
+
174
+ ## Troubleshooting
175
+
176
+ ### Issue 1: Environment file not found
177
+
178
+ **Symptom**: Error "No such file or directory: .env.cloudflare.local"
179
+
180
+ **Cause**: `.env.cloudflare.local` file doesn't exist
181
+
182
+ **Solution**: Create `.env.cloudflare.local` file with required Cloudflare variables. Copy from `.env.example` if available.
183
+
184
+ ### Issue 2: Wrangler authentication error
185
+
186
+ **Symptom**: "Not authenticated" or "Invalid API token"
187
+
188
+ **Cause**: Not logged in to Wrangler or token expired
189
+
190
+ **Solution**: Run `wrangler login` to authenticate with Cloudflare account
191
+
192
+ ### Issue 3: No logs appearing
193
+
194
+ **Symptom**: Tail starts but no logs show up
195
+
196
+ **Cause**: No requests being made to worker, or console.log statements removed
197
+
198
+ **Solution**: Make requests to your worker (visit the URL, send API requests), or add console.log statements to your code
199
+
200
+ ### Issue 4: Too many logs
201
+
202
+ **Symptom**: Logs scrolling too fast to read
203
+
204
+ **Cause**: High traffic or verbose logging
205
+
206
+ **Solution**:
207
+ - Use `wrangler tail --format pretty` for better formatting
208
+ - Filter logs with grep: `export $(cat .env.cloudflare.local | xargs) && wrangler tail | grep "ERROR"`
209
+ - Reduce console.log verbosity in code
210
+ - Filter by specific service: `wrangler tail | grep "DatabaseService"`
211
+
212
+ ### Issue 5: Can't stop tailing
213
+
214
+ **Symptom**: Ctrl+C doesn't stop the command
215
+
216
+ **Cause**: Terminal not responding to interrupt signal
217
+
218
+ **Solution**: Close the terminal tab, or use `kill` command from another terminal
219
+
220
+ ### Issue 6: SSR logs not showing
221
+
222
+ **Symptom**: Only seeing client-side logs
223
+
224
+ **Cause**: SSR console.log statements may be filtered or not present
225
+
226
+ **Solution**: Add explicit console.log statements in beforeLoad and server-side code to verify SSR execution
227
+
228
+ ---
229
+
230
+ ## Security Considerations
231
+
232
+ ### File Access
233
+ - **Reads**: `.env.cloudflare.local`
234
+ - **Writes**: None
235
+ - **Executes**: `wrangler tail`
236
+
237
+ ### Network Access
238
+ - **APIs**: Cloudflare API (for log streaming)
239
+ - **Repositories**: None
240
+
241
+ ### Sensitive Data
242
+ - **Secrets**: Sources `.env.cloudflare.local` which may contain API tokens
243
+ - **Credentials**: Wrangler uses stored Cloudflare credentials
244
+ - **⚠️ Warning**: Logs may contain sensitive data (user IDs, API responses) - be careful when sharing logs
245
+ - **⚠️ Warning**: Never commit logs to version control
246
+ - **⚠️ Warning**: Avoid logging sensitive user data (passwords, tokens, PII)
247
+
248
+ ---
249
+
250
+ ## Notes
251
+
252
+ - This command runs continuously until stopped with Ctrl+C
253
+ - Logs are streamed in real-time (not historical)
254
+ - Only shows logs from the current moment forward
255
+ - For historical logs, use Cloudflare dashboard
256
+ - Logs include console.log, console.error, console.warn from your worker
257
+ - Also shows request information (method, URL, status code)
258
+ - Useful for debugging production issues
259
+ - Can be combined with grep to filter specific logs
260
+ - Environment variables must be exported in the same command (using `&&`)
261
+ - TanStack Start logs both SSR (server) and client-side code
262
+ - beforeLoad executes on server, so logs appear in tail
263
+ - API routes execute on server, so logs appear in tail
264
+ - Client-side useEffect logs won't appear (only server-side)
265
+
266
+ ---
267
+
268
+ **Namespace**: tanstack-cloudflare
269
+ **Command**: tail
270
+ **Version**: 1.0.0
271
+ **Created**: 2026-02-21
272
+ **Last Updated**: 2026-02-21
273
+ **Status**: Active
274
+ **Compatibility**: TanStack Start, Cloudflare Workers, Wrangler 3.x+
275
+ **Author**: Patrick Michaelsen
File without changes
@@ -0,0 +1,154 @@
1
+ # {Feature/Pattern Name}
2
+
3
+ **Concept**: [One-line description of what this design addresses]
4
+ **Created**: YYYY-MM-DD
5
+ **Status**: Proposal | Design Specification | Implemented
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ [High-level description of what this design document covers and why it exists. Provide context about the problem space and the importance of this design decision.]
12
+
13
+ **Example**: "This document describes the authentication flow for multi-tenant access, enabling secure per-user data isolation across the system."
14
+
15
+ ---
16
+
17
+ ## Problem Statement
18
+
19
+ [Clearly articulate the problem this design solves. Include:]
20
+ - What challenge or limitation exists?
21
+ - Why is this a problem worth solving?
22
+ - What are the consequences of not solving it?
23
+
24
+ **Example**: "Without proper multi-tenant isolation, users could potentially access each other's data, creating security vulnerabilities and privacy concerns."
25
+
26
+ ---
27
+
28
+ ## Solution
29
+
30
+ [Describe the proposed solution at a conceptual level. Include:]
31
+ - High-level approach
32
+ - Key components involved
33
+ - How the solution addresses the problem
34
+ - Alternative approaches considered (and why they were rejected)
35
+
36
+ **Example**: "Implement row-level security using user_id as a tenant identifier, enforced at both the database and application layers."
37
+
38
+ ---
39
+
40
+ ## Implementation
41
+
42
+ [Provide technical details needed to implement this design. Include:]
43
+ - Architecture diagrams (as ASCII art or references)
44
+ - Data structures and schemas
45
+ - API interfaces
46
+ - Code examples (use placeholder names)
47
+ - Configuration requirements
48
+ - Dependencies
49
+
50
+ **Example**:
51
+ ```typescript
52
+ interface TenantContext {
53
+ userId: string;
54
+ permissions: string[];
55
+ }
56
+
57
+ class DataService {
58
+ constructor(private context: TenantContext) {}
59
+
60
+ async getData(id: string): Promise<Data> {
61
+ // Implementation with tenant filtering
62
+ }
63
+ }
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Benefits
69
+
70
+ [List the advantages of this approach:]
71
+ - Benefit 1: [Description]
72
+ - Benefit 2: [Description]
73
+ - Benefit 3: [Description]
74
+
75
+ **Example**:
76
+ - **Security**: Complete data isolation between tenants
77
+ - **Scalability**: Horizontal scaling without data mixing concerns
78
+ - **Compliance**: Meets data privacy regulations (GDPR, etc.)
79
+
80
+ ---
81
+
82
+ ## Trade-offs
83
+
84
+ [Honestly assess the downsides and limitations:]
85
+ - Trade-off 1: [Description and mitigation strategy]
86
+ - Trade-off 2: [Description and mitigation strategy]
87
+ - Trade-off 3: [Description and mitigation strategy]
88
+
89
+ **Example**:
90
+ - **Performance**: Additional filtering adds query overhead (mitigated by proper indexing)
91
+ - **Complexity**: More complex queries and testing requirements
92
+ - **Migration**: Existing data requires backfill with tenant identifiers
93
+
94
+ ---
95
+
96
+ ## Dependencies
97
+
98
+ [List any dependencies this design has:]
99
+ - External services or APIs
100
+ - Other design documents
101
+ - Infrastructure requirements
102
+ - Third-party libraries
103
+
104
+ ---
105
+
106
+ ## Testing Strategy
107
+
108
+ [Describe how to verify this design works correctly:]
109
+ - Unit test requirements
110
+ - Integration test scenarios
111
+ - Security test cases
112
+ - Performance benchmarks
113
+
114
+ ---
115
+
116
+ ## Migration Path
117
+
118
+ [If this changes existing functionality, describe the migration strategy:]
119
+ 1. Step 1: [Description]
120
+ 2. Step 2: [Description]
121
+ 3. Step 3: [Description]
122
+
123
+ ---
124
+
125
+ ## Key Design Decisions (Optional)
126
+
127
+ <!-- This section is populated by @acp.clarification-capture when
128
+ create commands are invoked with --from-clar, --from-chat, or
129
+ --from-context. It can also be manually authored.
130
+ Omit this section entirely if no decisions to capture.
131
+
132
+ Group decisions by agent-inferred category using tables:
133
+
134
+ ### {Category}
135
+
136
+ | Decision | Choice | Rationale |
137
+ |---|---|---|
138
+ | {decision} | {choice} | {rationale} |
139
+ -->
140
+
141
+ ---
142
+
143
+ ## Future Considerations
144
+
145
+ [Note any future enhancements or related work:]
146
+ - Future enhancement 1
147
+ - Future enhancement 2
148
+ - Related design documents to create
149
+
150
+ ---
151
+
152
+ **Status**: [Current implementation status]
153
+ **Recommendation**: [What should be done next - implement, review, revise, etc.]
154
+ **Related Documents**: [Links to related design docs, milestones, or tasks]