oneie 3.6.25 → 3.6.27

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 (55) hide show
  1. package/.claude/agents/TROUBLESHOOTING.md +530 -0
  2. package/.claude/agents/agent-builder.md +226 -198
  3. package/.claude/agents/agent-claude.md +645 -0
  4. package/.claude/agents/agent-designer.md +166 -11
  5. package/.claude/agents/agent-director.md +109 -41
  6. package/.claude/agents/agent-frontend.md +314 -27
  7. package/.claude/agents/agent-quality.md +377 -0
  8. package/.claude/commands/chat.md +504 -0
  9. package/.claude/commands/create.md +134 -18
  10. package/.claude/commands/fast.md +531 -0
  11. package/.claude/commands/one.md +12 -85
  12. package/.claude/commands/optimize.md +74 -0
  13. package/.claude/commands/plan.md +420 -373
  14. package/.claude/commands/review.md +99 -0
  15. package/.claude/commands/test.md +197 -0
  16. package/.claude/commands/validate.md +140 -0
  17. package/.claude/hooks/__pycache__/todo.cpython-312.pyc +0 -0
  18. package/.claude/hooks/auto-format.sh +106 -0
  19. package/.claude/hooks/formatting.py +187 -0
  20. package/.claude/hooks/ontology-validation.py +255 -0
  21. package/.claude/hooks/validate-imports.py +182 -0
  22. package/.claude/hooks/validate-ontology.py +140 -0
  23. package/CLAUDE.md +105 -0
  24. package/dist/commands/agent.d.ts +18 -0
  25. package/dist/commands/agent.d.ts.map +1 -0
  26. package/dist/commands/agent.js +271 -0
  27. package/dist/commands/agent.js.map +1 -0
  28. package/dist/commands/init.js +1 -1
  29. package/dist/commands/init.js.map +1 -1
  30. package/dist/index.js +20 -0
  31. package/dist/index.js.map +1 -1
  32. package/dist/lib/agent-detection.d.ts +19 -0
  33. package/dist/lib/agent-detection.d.ts.map +1 -0
  34. package/dist/lib/agent-detection.js +87 -0
  35. package/dist/lib/agent-detection.js.map +1 -0
  36. package/dist/lib/detect.d.ts +45 -0
  37. package/dist/lib/detect.d.ts.map +1 -0
  38. package/dist/lib/detect.js +221 -0
  39. package/dist/lib/detect.js.map +1 -0
  40. package/llms.txt +257 -0
  41. package/one/knowledge/cascading-context-specification.md +1617 -0
  42. package/one/knowledge/claude-code-integration.md +1293 -0
  43. package/one/knowledge/development-commands.md +251 -0
  44. package/one/knowledge/games-english.md +691 -0
  45. package/one/knowledge/games.md +1082 -0
  46. package/one/knowledge/guidelines.md +314 -0
  47. package/one/knowledge/parallel-agents.md +932 -0
  48. package/one/knowledge/performance.md +459 -0
  49. package/one/knowledge/troubleshooting.md +434 -0
  50. package/one/things/plans/dsl-claude-code.md +1011 -0
  51. package/one/things/plans/npx-agent-safety.md +785 -0
  52. package/one/things/plans/npx-agent.md +1089 -0
  53. package/one/things/plans/remove-backend-development-from-agents.md +1331 -0
  54. package/package.json +3 -2
  55. package/.claude/agents/AUDIT-agent-ops-alignment.md +0 -379
@@ -0,0 +1,530 @@
1
+ # TROUBLESHOOTING GUIDE FOR AI AGENTS
2
+
3
+ **Quick reference for resolving common development issues in ONE platform.**
4
+
5
+ ---
6
+
7
+ ## When to Use This Guide
8
+
9
+ **ALL agents should reference this guide when encountering:**
10
+ - TypeScript or build errors
11
+ - Authentication failures
12
+ - Hydration mismatches
13
+ - Styling issues
14
+ - Deployment failures
15
+ - Performance problems
16
+ - Multi-tenancy data leaks
17
+
18
+ **How to use:** Search for symptoms, apply solution, verify fix, then continue with your task.
19
+
20
+ ---
21
+
22
+ ## TypeScript Errors
23
+
24
+ ### Issue: TypeScript errors after schema changes
25
+
26
+ **Symptoms:**
27
+ - Type errors in Convex queries/mutations
28
+ - `_generated` types out of sync
29
+ - Import errors from `@/convex/_generated/api`
30
+
31
+ **Solution:**
32
+ ```bash
33
+ # Regenerate Convex types
34
+ cd backend && npx convex dev
35
+
36
+ # Check frontend types
37
+ cd web && bunx astro check
38
+ ```
39
+
40
+ **Prevention:**
41
+ - Always run `npx convex dev` after schema changes
42
+ - Wait for type generation to complete before coding
43
+ - Use TypeScript strict mode to catch issues early
44
+
45
+ ---
46
+
47
+ ## Authentication Issues
48
+
49
+ ### Issue: Auth not working
50
+
51
+ **Symptoms:**
52
+ - Login fails silently
53
+ - Session not persisting
54
+ - `getUserIdentity()` returns null
55
+
56
+ **Solution:**
57
+ ```bash
58
+ # 1. Check BETTER_AUTH_SECRET matches
59
+ # Compare web/.env.local and backend/.env.local
60
+ grep BETTER_AUTH_SECRET web/.env.local
61
+ grep BETTER_AUTH_SECRET backend/.env.local
62
+
63
+ # 2. Verify Convex deployment URL
64
+ grep PUBLIC_CONVEX_URL web/.env.local
65
+
66
+ # 3. Check auth configuration
67
+ cat backend/convex/auth.ts
68
+ ```
69
+
70
+ **Common Causes:**
71
+ - `BETTER_AUTH_SECRET` mismatch between frontend and backend
72
+ - Wrong `PUBLIC_CONVEX_URL` in frontend
73
+ - Missing OAuth credentials
74
+ - Rate limiting triggered (check `@convex-dev/rate-limiter` logs)
75
+
76
+ **Prevention:**
77
+ - Use same `.env.local` template for web and backend
78
+ - Generate `BETTER_AUTH_SECRET` once and share it
79
+ - Test auth flow after any environment variable changes
80
+
81
+ ---
82
+
83
+ ## Hydration Issues
84
+
85
+ ### Issue: Hydration mismatch
86
+
87
+ **Symptoms:**
88
+ - Console error: "Hydration failed"
89
+ - Component renders differently on server vs client
90
+ - Flash of unstyled content (FOUC)
91
+
92
+ **Solution:**
93
+ ```astro
94
+ <!-- Add client:load directive to interactive components -->
95
+ <ShoppingCart client:load />
96
+
97
+ <!-- Or use client:only for client-only components -->
98
+ <ClientOnlyWidget client:only="react" />
99
+ ```
100
+
101
+ **Common Causes:**
102
+ - Using browser APIs (localStorage, window) in SSR
103
+ - Date/time rendering (server timezone ≠ client timezone)
104
+ - Random values generated on server and client
105
+
106
+ **Prevention:**
107
+ ```typescript
108
+ // Use client-only rendering for browser APIs
109
+ import { useEffect, useState } from 'react';
110
+
111
+ function BrowserComponent() {
112
+ const [mounted, setMounted] = useState(false);
113
+
114
+ useEffect(() => {
115
+ setMounted(true);
116
+ }, []);
117
+
118
+ if (!mounted) return null;
119
+
120
+ // Safe to use browser APIs here
121
+ return <div>{localStorage.getItem('key')}</div>;
122
+ }
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Tailwind Styling Issues
128
+
129
+ ### Issue: Tailwind styles not applying
130
+
131
+ **Symptoms:**
132
+ - Colors not rendering
133
+ - Custom theme variables not working
134
+ - Dark mode not switching
135
+
136
+ **Solution:**
137
+ ```css
138
+ /* Ensure HSL format with hsl() wrapper */
139
+ @theme {
140
+ --color-background: 0 0% 100%; /* HSL format */
141
+ }
142
+
143
+ .my-component {
144
+ background-color: hsl(var(--color-background)); /* hsl() wrapper */
145
+ }
146
+ ```
147
+
148
+ **Common Causes:**
149
+ - Using OKLCH format instead of HSL
150
+ - Missing `hsl()` wrapper around CSS variables
151
+ - Using `@apply` directive (not supported in Tailwind v4)
152
+ - Missing `@source` directive for component files
153
+
154
+ **Prevention:**
155
+ - Always use HSL format: `H S% L%`
156
+ - Always wrap with `hsl()`: `hsl(var(--color-name))`
157
+ - Never use `@apply` in Tailwind v4
158
+ - Add `@source` directive to scan all component files
159
+
160
+ ---
161
+
162
+ ## Build Issues
163
+
164
+ ### Issue: Build fails on Cloudflare
165
+
166
+ **Symptoms:**
167
+ - `react-dom/server` module not found
168
+ - Edge runtime errors
169
+ - SSR errors in production
170
+
171
+ **Solution:**
172
+ ```javascript
173
+ // astro.config.mjs
174
+ export default defineConfig({
175
+ vite: {
176
+ resolve: {
177
+ alias: {
178
+ 'react-dom/server': 'react-dom/server.edge'
179
+ }
180
+ }
181
+ }
182
+ });
183
+ ```
184
+
185
+ **Common Causes:**
186
+ - Missing `react-dom/server.edge` alias
187
+ - Using Node.js-specific APIs in edge runtime
188
+ - Missing environment variables in Cloudflare Pages
189
+
190
+ **Prevention:**
191
+ - Use `react-dom/server.edge` for Cloudflare compatibility
192
+ - Test builds locally: `bun run build`
193
+ - Verify environment variables in Cloudflare dashboard
194
+
195
+ ---
196
+
197
+ ## Convex Issues
198
+
199
+ ### Issue: Query not updating in real-time
200
+
201
+ **Symptoms:**
202
+ - `useQuery` returns stale data
203
+ - Changes in database not reflected in UI
204
+ - Real-time subscriptions not working
205
+
206
+ **Solution:**
207
+ ```typescript
208
+ // Ensure using useQuery (not ConvexHttpClient)
209
+ import { useQuery } from "convex/react";
210
+ import { api } from "@/convex/_generated/api";
211
+
212
+ function MyComponent() {
213
+ // CORRECT: Real-time subscription
214
+ const data = useQuery(api.queries.things.list, { groupId });
215
+
216
+ // WRONG: Static fetch (no real-time updates)
217
+ // const data = await client.query(api.queries.things.list, { groupId });
218
+ }
219
+ ```
220
+
221
+ **Common Causes:**
222
+ - Using `ConvexHttpClient` instead of `useQuery` hook
223
+ - Component not wrapped in `ConvexProvider`
224
+ - Query invalidation not triggered
225
+ - Index not defined for query pattern
226
+
227
+ **Prevention:**
228
+ - Always use `useQuery` for real-time data
229
+ - Wrap app in `ConvexProvider`
230
+ - Define indexes for all query patterns
231
+ - Test real-time updates during development
232
+
233
+ ---
234
+
235
+ ## Content Collections Issues
236
+
237
+ ### Issue: Content not found or types missing
238
+
239
+ **Symptoms:**
240
+ - `getCollection()` returns empty array
241
+ - Type errors on `post.data` fields
242
+ - Content not appearing on pages
243
+
244
+ **Solution:**
245
+ ```bash
246
+ # Regenerate content types
247
+ bunx astro sync
248
+
249
+ # Check content directory structure
250
+ ls -la src/content/blog/
251
+
252
+ # Verify schema matches content
253
+ cat src/content/config.ts
254
+ ```
255
+
256
+ **Common Causes:**
257
+ - Missing `bunx astro sync` after content changes
258
+ - Schema doesn't match content frontmatter
259
+ - Content files in wrong directory
260
+ - Invalid YAML frontmatter
261
+
262
+ **Prevention:**
263
+ - Run `bunx astro sync` after adding/changing content
264
+ - Validate frontmatter matches schema
265
+ - Use TypeScript types: `CollectionEntry<"blog">`
266
+ - Test content rendering locally before deploying
267
+
268
+ ---
269
+
270
+ ## Multi-Tenancy Issues
271
+
272
+ ### Issue: Cross-tenant data leaks
273
+
274
+ **Symptoms:**
275
+ - User sees data from other groups
276
+ - Queries return data from wrong groupId
277
+ - Security audit fails
278
+
279
+ **Solution:**
280
+ ```typescript
281
+ // ALWAYS validate group access
282
+ const group = await ctx.db.get(args.groupId);
283
+ if (!group || group.status !== "active") {
284
+ throw new Error("Invalid group");
285
+ }
286
+
287
+ // ALWAYS scope queries by groupId
288
+ const things = await ctx.db
289
+ .query("things")
290
+ .withIndex("group_type", q =>
291
+ q.eq("groupId", args.groupId).eq("type", args.type)
292
+ )
293
+ .collect();
294
+ ```
295
+
296
+ **Common Causes:**
297
+ - Missing groupId validation
298
+ - Query without groupId scope
299
+ - Using wrong groupId from session
300
+ - Hierarchical access not implemented correctly
301
+
302
+ **Prevention:**
303
+ - NEVER query without groupId scope
304
+ - Validate group exists and is active
305
+ - Test with multiple groups during development
306
+ - Add integration tests for multi-tenancy
307
+
308
+ ---
309
+
310
+ ## Performance Issues
311
+
312
+ ### Issue: Slow page loads or high JS bundle size
313
+
314
+ **Symptoms:**
315
+ - Lighthouse score < 90
316
+ - Large JavaScript bundles (> 200KB)
317
+ - Slow Time to Interactive (TTI)
318
+
319
+ **Solution:**
320
+ ```astro
321
+ <!-- Use appropriate client directives -->
322
+ <HeavyComponent client:visible /> <!-- Load when visible -->
323
+ <SearchBox client:idle /> <!-- Load when idle -->
324
+ <CriticalComponent client:load /> <!-- Load immediately -->
325
+
326
+ <!-- Dynamic imports for heavy components -->
327
+ <script>
328
+ const HeavyChart = lazy(() => import('./HeavyChart'));
329
+ </script>
330
+ ```
331
+
332
+ **Common Causes:**
333
+ - Overuse of `client:load` directive
334
+ - No code splitting
335
+ - Heavy libraries in client bundle
336
+ - No lazy loading for images/components
337
+
338
+ **Prevention:**
339
+ - Default to static HTML (no client directive)
340
+ - Use `client:idle` or `client:visible` for non-critical components
341
+ - Dynamic import heavy libraries
342
+ - Lazy load images with `loading="lazy"`
343
+
344
+ ---
345
+
346
+ ## Deployment Issues
347
+
348
+ ### Issue: Environment variables not working in production
349
+
350
+ **Symptoms:**
351
+ - `process.env.VAR_NAME` is undefined
352
+ - API calls fail with auth errors
353
+ - Database connection fails
354
+
355
+ **Solution:**
356
+ ```bash
357
+ # 1. Check Cloudflare Pages environment variables
358
+ wrangler pages deployment list --project-name=web
359
+
360
+ # 2. Add variables in Cloudflare dashboard
361
+ # Settings → Environment Variables
362
+
363
+ # 3. Ensure PUBLIC_ prefix for client-side vars
364
+ PUBLIC_CONVEX_URL=https://...
365
+ BETTER_AUTH_SECRET=... # Server-side only
366
+ ```
367
+
368
+ **Common Causes:**
369
+ - Missing environment variables in Cloudflare dashboard
370
+ - Forgetting `PUBLIC_` prefix for client-side variables
371
+ - Wrong deployment environment (preview vs production)
372
+ - Environment variables not synced after changes
373
+
374
+ **Prevention:**
375
+ - Use `PUBLIC_` prefix for client-accessible variables
376
+ - Add all variables to Cloudflare dashboard
377
+ - Test in preview deployment before production
378
+ - Document all required environment variables
379
+
380
+ ---
381
+
382
+ ## Git Issues
383
+
384
+ ### Issue: Merge conflicts in generated files
385
+
386
+ **Symptoms:**
387
+ - Conflicts in `_generated/` directory
388
+ - Conflicts in `package-lock.json` or `bun.lockb`
389
+ - Conflicts in `.astro/` cache
390
+
391
+ **Solution:**
392
+ ```bash
393
+ # For generated files, prefer theirs and regenerate
394
+ git checkout --theirs backend/convex/_generated/
395
+ cd backend && npx convex dev
396
+
397
+ # For lockfiles, regenerate
398
+ rm bun.lockb
399
+ bun install
400
+
401
+ # For cache, delete and rebuild
402
+ rm -rf .astro/
403
+ bunx astro sync
404
+ ```
405
+
406
+ **Prevention:**
407
+ - Add `_generated/` to `.gitignore` (already done)
408
+ - Commit lockfiles carefully
409
+ - Clear cache before merging: `rm -rf .astro/`
410
+
411
+ ---
412
+
413
+ ## Quick Diagnostic Commands
414
+
415
+ ```bash
416
+ # Check all types
417
+ bunx astro check && cd backend && npx convex dev
418
+
419
+ # View backend logs
420
+ cd backend && npx convex logs --history 50
421
+
422
+ # Test auth flow
423
+ cd web && bun test test/auth/
424
+
425
+ # Check environment
426
+ env | grep CONVEX
427
+ env | grep BETTER_AUTH
428
+
429
+ # Verify build
430
+ cd web && bun run build
431
+ ```
432
+
433
+ ---
434
+
435
+ ## Agent-Specific Troubleshooting
436
+
437
+ ### agent-backend
438
+
439
+ **Before creating mutations/queries:**
440
+ - Verify schema exists in `backend/convex/schema.ts`
441
+ - Check if indexes are defined for query patterns
442
+ - Validate groupId scoping for multi-tenancy
443
+
444
+ **If types are missing:**
445
+ - Run `cd backend && npx convex dev`
446
+ - Wait for `_generated/` directory to update
447
+ - Verify imports from `@/convex/_generated/api`
448
+
449
+ ### agent-frontend
450
+
451
+ **Before creating components:**
452
+ - Check if shadcn/ui component exists: `bunx shadcn@latest add <component>`
453
+ - Verify Tailwind theme variables in `src/styles/global.css`
454
+ - Test SSR compatibility for browser APIs
455
+
456
+ **If hydration fails:**
457
+ - Add `client:load` or `client:only="react"` directives
458
+ - Move browser API usage inside `useEffect`
459
+ - Test with both SSR and CSR modes
460
+
461
+ ### agent-quality
462
+
463
+ **Before defining tests:**
464
+ - Verify test structure matches existing patterns in `web/test/`
465
+ - Check if test fixtures exist for auth/session
466
+ - Validate test database isolation
467
+
468
+ **If tests fail:**
469
+ - Check environment variables in test config
470
+ - Verify Convex backend is running during integration tests
471
+ - Inspect test logs: `bun test --verbose`
472
+
473
+ ### agent-ops
474
+
475
+ **Before deploying:**
476
+ - Verify all environment variables are set in Cloudflare dashboard
477
+ - Check build passes locally: `bun run build`
478
+ - Validate Convex deployment is up: `cd backend && npx convex deploy`
479
+
480
+ **If deployment fails:**
481
+ - Check Cloudflare Pages build logs
482
+ - Verify `CLOUDFLARE_GLOBAL_API_KEY` is set
483
+ - Test edge runtime compatibility
484
+
485
+ ### agent-integrator
486
+
487
+ **Before connecting external systems:**
488
+ - Verify API credentials are in environment variables
489
+ - Check if integration already exists in `one/connections/`
490
+ - Validate protocol compliance (A2A, ACP, AP2, X402, AG-UI)
491
+
492
+ **If integration fails:**
493
+ - Check external API status/rate limits
494
+ - Verify webhook URLs are accessible
495
+ - Test with mock data first
496
+
497
+ ---
498
+
499
+ ## Escalation Path
500
+
501
+ **If issue persists after trying solutions:**
502
+
503
+ 1. **Check source documentation:**
504
+ - `/one/knowledge/troubleshooting.md` (this file's source)
505
+ - `/one/knowledge/guidelines.md` (development best practices)
506
+ - `/one/knowledge/architecture.md` (platform structure)
507
+
508
+ 2. **Search existing patterns:**
509
+ - `grep -r "similar pattern" web/src/`
510
+ - Check `one/connections/patterns.md`
511
+
512
+ 3. **Ask user for clarification:**
513
+ - Use `AskUserQuestion` tool
514
+ - Provide specific options based on troubleshooting
515
+ - Include context from error messages
516
+
517
+ 4. **Document new solutions:**
518
+ - If you discover a new fix, update `one/knowledge/troubleshooting.md`
519
+ - Add to relevant agent documentation
520
+ - Log in `one/events/` for future reference
521
+
522
+ ---
523
+
524
+ **Golden Rule: When in doubt, regenerate types, clear cache, and rebuild.**
525
+
526
+ ```bash
527
+ # The nuclear option (fixes 90% of mysterious issues)
528
+ cd backend && npx convex dev &
529
+ cd web && rm -rf .astro/ && bunx astro sync && bun run build
530
+ ```