oneie 3.5.0 → 3.6.3

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 (141) hide show
  1. package/.claude/agents/agent-director.md +902 -22
  2. package/.claude/agents/agent-onboard-example-output.md +600 -0
  3. package/.claude/agents/agent-onboard.md +576 -0
  4. package/.claude/commands/ONBOARDING_ENHANCEMENT_SUMMARY.md +266 -0
  5. package/.claude/commands/deploy.md +77 -150
  6. package/.claude/commands/one.md +375 -5
  7. package/.claude/commands/release.md +64 -3
  8. package/.mcp.json +57 -0
  9. package/CLAUDE.md +55 -69
  10. package/CREATE-WEBSITE.md +442 -0
  11. package/SECURITY.md +31 -0
  12. package/TESTING-ONBOARDING.md +185 -0
  13. package/dist/commands/create-website.d.ts +19 -0
  14. package/dist/commands/create-website.d.ts.map +1 -0
  15. package/dist/commands/create-website.js +231 -0
  16. package/dist/commands/create-website.js.map +1 -0
  17. package/dist/commands/init.d.ts +5 -6
  18. package/dist/commands/init.d.ts.map +1 -1
  19. package/dist/commands/init.js +213 -103
  20. package/dist/commands/init.js.map +1 -1
  21. package/dist/index.js +7 -5
  22. package/dist/index.js.map +1 -1
  23. package/dist/utils/installation-setup.d.ts +24 -1
  24. package/dist/utils/installation-setup.d.ts.map +1 -1
  25. package/dist/utils/installation-setup.js +85 -1
  26. package/dist/utils/installation-setup.js.map +1 -1
  27. package/dist/utils/launch-claude.d.ts +6 -0
  28. package/dist/utils/launch-claude.d.ts.map +1 -0
  29. package/dist/utils/launch-claude.js +51 -0
  30. package/dist/utils/launch-claude.js.map +1 -0
  31. package/dist/utils/validation.d.ts +48 -0
  32. package/dist/utils/validation.d.ts.map +1 -0
  33. package/dist/utils/validation.js +73 -0
  34. package/dist/utils/validation.js.map +1 -0
  35. package/folders.yaml +1 -1
  36. package/one/.obsidian/core-plugins.json +33 -0
  37. package/one/.obsidian/workspace.json +20 -20
  38. package/one/connections/workflow-onboarding.md +683 -0
  39. package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +354 -0
  40. package/one/events/CRITICAL-FIXES-COMPLETE.md +504 -0
  41. package/one/events/DEPLOYMENT.md +178 -0
  42. package/one/events/ECOMMERCE-DEMO-PLAN.md +225 -0
  43. package/one/events/ECOMMERCE-LIVE-DEMO.md +363 -0
  44. package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +735 -0
  45. package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +923 -0
  46. package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +223 -0
  47. package/one/events/HANDOFF.md +313 -0
  48. package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +503 -0
  49. package/one/events/IMPLEMENTATION_SUMMARY.md +529 -0
  50. package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +666 -0
  51. package/one/events/LANDING-PAGE-IMPLEMENTATION.md +642 -0
  52. package/one/events/LANDING-PAGE-QUICKSTART.md +407 -0
  53. package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +1627 -0
  54. package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +573 -0
  55. package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +398 -0
  56. package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +525 -0
  57. package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +455 -0
  58. package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +486 -0
  59. package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +203 -0
  60. package/one/events/SECURITY-AUDIT-FIXES.md +376 -0
  61. package/one/events/SECURITY-SCAN-COMPLETE.md +281 -0
  62. package/one/events/SHOP-BUILD-STATUS.md +114 -0
  63. package/one/events/SHOP-PREMIUM-UPDATE.md +149 -0
  64. package/one/events/SITE-WIDE-GRADIENT-FIX.md +299 -0
  65. package/one/events/STORE-PRODUCTION-READY-STATUS.md +359 -0
  66. package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +429 -0
  67. package/one/events/agent-director-enhancement-summary.md +386 -0
  68. package/one/events/agent-onboard-implementation-summary.md +457 -0
  69. package/one/events/clean-agent-ontology-cleanup-report.md +353 -0
  70. package/one/events/landing-page-generator.md +458 -0
  71. package/one/events/onboarding-implementation-complete.md +505 -0
  72. package/one/events/release.md +254 -0
  73. package/one/events/separate-implementation-status.md +537 -0
  74. package/one/knowledge/100-inference-quick-reference.md +431 -0
  75. package/one/knowledge/agent-onboard-usage.md +612 -0
  76. package/one/knowledge/cli-claude-handoff.md +718 -0
  77. package/one/knowledge/ontology-blog.yaml +31 -0
  78. package/one/knowledge/ontology-cheatsheet.md +591 -0
  79. package/one/knowledge/ontology-community.yaml +42 -0
  80. package/one/knowledge/ontology-core-universal.md +722 -0
  81. package/one/knowledge/ontology-core.yaml +50 -0
  82. package/one/knowledge/ontology-courses.yaml +53 -0
  83. package/one/knowledge/ontology-creator.md +376 -0
  84. package/one/knowledge/ontology-developer-guide.md +789 -0
  85. package/one/knowledge/ontology-education.md +920 -0
  86. package/one/knowledge/ontology-index.md +354 -0
  87. package/one/knowledge/ontology-migration-guide.md +811 -0
  88. package/one/knowledge/ontology-minimal.yaml +1 -1
  89. package/one/knowledge/ontology-portfolio.yaml +31 -0
  90. package/one/knowledge/ontology-quickstart.md +576 -0
  91. package/one/knowledge/ontology-shop.yaml +121 -0
  92. package/one/knowledge/ontology-tokens.yaml +32 -0
  93. package/one/knowledge/ontology-tutorial.md +434 -0
  94. package/one/knowledge/ontology-video-script.md +890 -0
  95. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +467 -0
  96. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +408 -0
  97. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +369 -0
  98. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +396 -0
  99. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +468 -0
  100. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +582 -0
  101. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +449 -0
  102. package/one/things/docs/ecommerce/QUICK-START.md +368 -0
  103. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +498 -0
  104. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +237 -0
  105. package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +171 -0
  106. package/one/things/docs/ecommerce/demo.astro +309 -0
  107. package/one/things/plans/agent-director-100-inference-plans.md +410 -0
  108. package/one/things/plans/dual-website-strategy.md +612 -0
  109. package/one/things/plans/feature-based-sites.md +821 -0
  110. package/one/things/plans/multi-ontology-architecture.md +836 -0
  111. package/one/things/plans/onboarding.md +32 -0
  112. package/one/things/plans/separate.md +15 -17
  113. package/one/things/plans/start-new.md +738 -0
  114. package/package.json +7 -2
  115. package/one/things/claude/hooks/agent-hook-manager.js +0 -525
  116. package/one/things/claude/hooks/agent-load-balancer.js +0 -271
  117. package/one/things/claude/hooks/agent-request-interceptor.js +0 -70
  118. package/one/things/claude/hooks/cascade-feedback.js +0 -297
  119. package/one/things/claude/hooks/cascade-integration-hooks.js +0 -648
  120. package/one/things/claude/hooks/continuous-improvement-monitor.js +0 -510
  121. package/one/things/claude/hooks/file-organization-engine.js +0 -427
  122. package/one/things/claude/hooks/file-organization-monitor.js +0 -269
  123. package/one/things/claude/hooks/hook-config-manager.js +0 -202
  124. package/one/things/claude/hooks/hook-orchestrator.js +0 -662
  125. package/one/things/claude/hooks/hook-performance-report.js +0 -120
  126. package/one/things/claude/hooks/mcp-cascade-integration.js +0 -816
  127. package/one/things/claude/hooks/memory-optimizer.js +0 -510
  128. package/one/things/claude/hooks/ontology-compliance.js +0 -394
  129. package/one/things/claude/hooks/ontology-hook-manager.js +0 -316
  130. package/one/things/claude/hooks/ontology-validation-engine.js +0 -317
  131. package/one/things/claude/hooks/performance-monitoring-hook.js +0 -422
  132. package/one/things/claude/hooks/quality-scoring-engine.js +0 -834
  133. package/one/things/claude/hooks/simple-load-balancer.js +0 -238
  134. package/one/things/claude/hooks/startup-optimizer.js +0 -625
  135. package/one/things/claude/hooks/story-scoring-system.js +0 -445
  136. package/one/things/claude/hooks/story-validation-engine.js +0 -473
  137. package/one/things/claude/hooks/structure-synchronizer.js +0 -194
  138. package/one/things/claude/hooks/sub-agent-output-validator.js +0 -647
  139. package/one/things/claude/hooks/sub-agent-validation-hook.js +0 -343
  140. package/one/things/claude/hooks/trinity-validation-system.js +0 -392
  141. package/one/things/plans/organizations-to-groups.md +0 -705
@@ -0,0 +1,31 @@
1
+ feature: blog
2
+ extends: core
3
+ description: Blog and content publishing
4
+
5
+ thingTypes:
6
+ - name: blog_post
7
+ properties:
8
+ title: string
9
+ slug: string
10
+ content: string
11
+ excerpt: string
12
+ featuredImage: string
13
+ publishedAt: number
14
+ tags: string[]
15
+ category: string
16
+ - name: blog_category
17
+ properties:
18
+ name: string
19
+ slug: string
20
+ description: string
21
+
22
+ connectionTypes:
23
+ - name: posted_in
24
+ fromType: blog_post
25
+ toType: blog_category
26
+
27
+ eventTypes:
28
+ - name: blog_post_published
29
+ thingType: blog_post
30
+ - name: blog_post_viewed
31
+ thingType: blog_post
@@ -0,0 +1,591 @@
1
+ # Multi-Ontology Architecture Cheat Sheet
2
+
3
+ **Quick Reference Guide** | **Version:** 1.0.0
4
+
5
+ ---
6
+
7
+ ## Quick Commands
8
+
9
+ ```bash
10
+ # Generate types from core only
11
+ bun run backend/scripts/generate-ontology-types.ts
12
+
13
+ # Generate types with specific features
14
+ PUBLIC_FEATURES="blog,shop" bun run backend/scripts/generate-ontology-types.ts
15
+
16
+ # Generate types with all features
17
+ PUBLIC_FEATURES="blog,shop,courses,newsletter" bun run backend/scripts/generate-ontology-types.ts
18
+
19
+ # Validate ontology YAML
20
+ bun run backend/scripts/validate-ontology.ts ontology-myfeature.yaml
21
+
22
+ # Run tests for a feature
23
+ cd backend
24
+ bun test tests/myfeature.test.ts
25
+ ```
26
+
27
+ ---
28
+
29
+ ## YAML Template
30
+
31
+ ### Minimal Feature Ontology
32
+
33
+ ```yaml
34
+ feature: myfeature
35
+ extends: core
36
+ version: "1.0.0"
37
+ description: "Brief description of what this feature does"
38
+
39
+ thingTypes:
40
+ - name: my_thing
41
+ description: "What this thing represents"
42
+ properties:
43
+ field1: string
44
+ field2: number
45
+ field3: boolean
46
+
47
+ connectionTypes:
48
+ - name: my_connection
49
+ description: "How things relate"
50
+ fromType: source_type
51
+ toType: target_type
52
+ metadata:
53
+ extraField: string
54
+
55
+ eventTypes:
56
+ - name: my_event
57
+ description: "What action happened"
58
+ thingType: my_thing
59
+ ```
60
+
61
+ ### Full Feature Ontology Template
62
+
63
+ ```yaml
64
+ # Feature Name Ontology
65
+ # Detailed description of feature purpose and capabilities
66
+
67
+ feature: myfeature
68
+ extends: core
69
+ version: "1.0.0"
70
+ description: "What this feature provides"
71
+ author: "Your Name"
72
+ dependencies:
73
+ - otherfeat
74
+
75
+ # ============================================================================
76
+ # Thing Types - Entities that exist
77
+ # ============================================================================
78
+
79
+ thingTypes:
80
+ - name: my_entity
81
+ description: "Primary entity description"
82
+ properties:
83
+ # Core fields
84
+ name: string
85
+ description: string
86
+ slug: string
87
+
88
+ # Status and metadata
89
+ status: string # active, inactive, draft
90
+ createdBy: string # User ID
91
+
92
+ # Feature-specific fields
93
+ customField1: string
94
+ customField2: number
95
+ customField3: boolean
96
+ customList: string[]
97
+ customObject: object
98
+
99
+ example:
100
+ type: my_entity
101
+ name: "Example Entity"
102
+ properties:
103
+ name: "Example Entity"
104
+ status: "active"
105
+ customField1: "value"
106
+
107
+ - name: my_child_entity
108
+ description: "Related entity"
109
+ properties:
110
+ parentId: string
111
+ childField: string
112
+
113
+ # ============================================================================
114
+ # Connection Types - Relationships
115
+ # ============================================================================
116
+
117
+ connectionTypes:
118
+ - name: owns_entity
119
+ description: "Creator owns entity"
120
+ fromType: creator # From core
121
+ toType: my_entity
122
+ metadata:
123
+ role: string
124
+ permissions: string[]
125
+
126
+ - name: parent_child
127
+ description: "Parent-child relationship"
128
+ fromType: my_entity
129
+ toType: my_child_entity
130
+ metadata:
131
+ order: number
132
+
133
+ - name: related_to
134
+ description: "Generic relationship"
135
+ fromType: my_entity
136
+ toType: my_entity # Self-referential
137
+ metadata:
138
+ relationshipType: string
139
+
140
+ # ============================================================================
141
+ # Event Types - Actions that occur
142
+ # ============================================================================
143
+
144
+ eventTypes:
145
+ # Lifecycle events
146
+ - name: entity_created
147
+ description: "Entity was created"
148
+ thingType: my_entity
149
+
150
+ - name: entity_updated
151
+ description: "Entity was modified"
152
+ thingType: my_entity
153
+
154
+ - name: entity_deleted
155
+ description: "Entity was deleted"
156
+ thingType: my_entity
157
+
158
+ # Action events
159
+ - name: entity_activated
160
+ description: "Entity became active"
161
+ thingType: my_entity
162
+
163
+ - name: entity_viewed
164
+ description: "Someone viewed entity"
165
+ thingType: my_entity
166
+
167
+ # Interaction events
168
+ - name: entity_shared
169
+ description: "Entity was shared"
170
+ thingType: my_entity
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Common Code Patterns
176
+
177
+ ### 1. Create Entity with Ownership
178
+
179
+ ```typescript
180
+ import { mutation } from '../_generated/server';
181
+ import { v } from 'convex/values';
182
+ import type { ThingType, ConnectionType, EventType } from '../types/ontology';
183
+
184
+ export const create = mutation({
185
+ args: {
186
+ groupId: v.id('groups'),
187
+ name: v.string(),
188
+ properties: v.any(),
189
+ },
190
+ handler: async (ctx, args) => {
191
+ const userId = await ctx.auth.getUserIdentity();
192
+ if (!userId) throw new Error('Unauthorized');
193
+
194
+ // 1. Create entity
195
+ const entityId = await ctx.db.insert('entities', {
196
+ groupId: args.groupId,
197
+ type: 'my_entity' as ThingType,
198
+ name: args.name,
199
+ properties: {
200
+ ...args.properties,
201
+ createdBy: userId.tokenIdentifier,
202
+ },
203
+ status: 'active',
204
+ createdAt: Date.now(),
205
+ updatedAt: Date.now(),
206
+ });
207
+
208
+ // 2. Create ownership connection
209
+ await ctx.db.insert('connections', {
210
+ groupId: args.groupId,
211
+ fromEntityId: userId.tokenIdentifier,
212
+ toEntityId: entityId,
213
+ relationshipType: 'owns' as ConnectionType,
214
+ metadata: {
215
+ role: 'owner',
216
+ permissions: ['read', 'write', 'delete'],
217
+ },
218
+ createdAt: Date.now(),
219
+ });
220
+
221
+ // 3. Log creation event
222
+ await ctx.db.insert('events', {
223
+ groupId: args.groupId,
224
+ type: 'entity_created' as EventType,
225
+ actorId: userId.tokenIdentifier,
226
+ targetId: entityId,
227
+ timestamp: Date.now(),
228
+ metadata: {},
229
+ });
230
+
231
+ return entityId;
232
+ },
233
+ });
234
+ ```
235
+
236
+ ### 2. Query Entities with Connections
237
+
238
+ ```typescript
239
+ import { query } from '../_generated/server';
240
+ import { v } from 'convex/values';
241
+
242
+ export const listWithOwners = query({
243
+ args: {
244
+ groupId: v.id('groups'),
245
+ },
246
+ handler: async (ctx, args) => {
247
+ // Get entities
248
+ const entities = await ctx.db
249
+ .query('entities')
250
+ .withIndex('group_type', (q) =>
251
+ q.eq('groupId', args.groupId).eq('type', 'my_entity')
252
+ )
253
+ .collect();
254
+
255
+ // Get owners for each entity
256
+ const entitiesWithOwners = await Promise.all(
257
+ entities.map(async (entity) => {
258
+ const ownership = await ctx.db
259
+ .query('connections')
260
+ .withIndex('to_type', (q) =>
261
+ q.eq('toEntityId', entity._id).eq('relationshipType', 'owns')
262
+ )
263
+ .first();
264
+
265
+ const owner = ownership
266
+ ? await ctx.db.get(ownership.fromEntityId)
267
+ : null;
268
+
269
+ return {
270
+ ...entity,
271
+ owner,
272
+ ownerRole: ownership?.metadata?.role,
273
+ };
274
+ })
275
+ );
276
+
277
+ return entitiesWithOwners;
278
+ },
279
+ });
280
+ ```
281
+
282
+ ### 3. Type Validation
283
+
284
+ ```typescript
285
+ import { isThingType, isConnectionType, isEventType } from '../types/ontology';
286
+
287
+ // Validate thing type
288
+ export const validateEntity = mutation({
289
+ args: {
290
+ type: v.string(),
291
+ },
292
+ handler: async (ctx, args) => {
293
+ if (!isThingType(args.type)) {
294
+ throw new Error(`Invalid entity type: ${args.type}`);
295
+ }
296
+
297
+ // Now TypeScript knows args.type is valid
298
+ const entity = await ctx.db.insert('entities', {
299
+ type: args.type as ThingType,
300
+ // ...
301
+ });
302
+ },
303
+ });
304
+ ```
305
+
306
+ ### 4. Feature Detection
307
+
308
+ ```typescript
309
+ import { ONTOLOGY_METADATA } from '../types/ontology';
310
+
311
+ export const getFeatures = query({
312
+ handler: async () => {
313
+ return {
314
+ enabled: ONTOLOGY_METADATA.features,
315
+ hasBlog: ONTOLOGY_METADATA.features.includes('blog'),
316
+ hasShop: ONTOLOGY_METADATA.features.includes('shop'),
317
+ counts: {
318
+ things: ONTOLOGY_METADATA.thingTypeCount,
319
+ connections: ONTOLOGY_METADATA.connectionTypeCount,
320
+ events: ONTOLOGY_METADATA.eventTypeCount,
321
+ },
322
+ };
323
+ },
324
+ });
325
+
326
+ // Conditional logic
327
+ export const createContent = mutation({
328
+ handler: async (ctx, args) => {
329
+ const features = ONTOLOGY_METADATA.features;
330
+
331
+ if (args.type === 'blog_post' && !features.includes('blog')) {
332
+ throw new Error('Blog feature not enabled');
333
+ }
334
+
335
+ // Create entity...
336
+ },
337
+ });
338
+ ```
339
+
340
+ ### 5. Batch Operations
341
+
342
+ ```typescript
343
+ export const batchCreate = mutation({
344
+ args: {
345
+ groupId: v.id('groups'),
346
+ entities: v.array(
347
+ v.object({
348
+ type: v.string(),
349
+ name: v.string(),
350
+ properties: v.any(),
351
+ })
352
+ ),
353
+ },
354
+ handler: async (ctx, args) => {
355
+ const results = [];
356
+
357
+ for (const entity of args.entities) {
358
+ if (!isThingType(entity.type)) {
359
+ results.push({
360
+ name: entity.name,
361
+ success: false,
362
+ error: 'Invalid type',
363
+ });
364
+ continue;
365
+ }
366
+
367
+ try {
368
+ const id = await ctx.db.insert('entities', {
369
+ groupId: args.groupId,
370
+ type: entity.type as ThingType,
371
+ name: entity.name,
372
+ properties: entity.properties,
373
+ status: 'active',
374
+ createdAt: Date.now(),
375
+ updatedAt: Date.now(),
376
+ });
377
+
378
+ results.push({
379
+ name: entity.name,
380
+ success: true,
381
+ id,
382
+ });
383
+ } catch (error) {
384
+ results.push({
385
+ name: entity.name,
386
+ success: false,
387
+ error: (error as Error).message,
388
+ });
389
+ }
390
+ }
391
+
392
+ return results;
393
+ },
394
+ });
395
+ ```
396
+
397
+ ### 6. Analytics from Events
398
+
399
+ ```typescript
400
+ export const getAnalytics = query({
401
+ args: {
402
+ entityId: v.id('entities'),
403
+ days: v.optional(v.number()),
404
+ },
405
+ handler: async (ctx, args) => {
406
+ const since = Date.now() - (args.days || 30) * 24 * 60 * 60 * 1000;
407
+
408
+ const events = await ctx.db
409
+ .query('events')
410
+ .withIndex('target_time', (q) =>
411
+ q.eq('targetId', args.entityId).gte('timestamp', since)
412
+ )
413
+ .collect();
414
+
415
+ // Group by event type
416
+ const byType = events.reduce((acc, event) => {
417
+ acc[event.type] = (acc[event.type] || 0) + 1;
418
+ return acc;
419
+ }, {} as Record<string, number>);
420
+
421
+ return {
422
+ period: `${args.days || 30} days`,
423
+ totalEvents: events.length,
424
+ byType,
425
+ timeline: events.map((e) => ({
426
+ type: e.type,
427
+ timestamp: e.timestamp,
428
+ actor: e.actorId,
429
+ })),
430
+ };
431
+ },
432
+ });
433
+ ```
434
+
435
+ ---
436
+
437
+ ## Type Reference
438
+
439
+ ### Generated Types
440
+
441
+ ```typescript
442
+ // Auto-generated from ontologies
443
+ import type {
444
+ ThingType, // Union of all thing types
445
+ ConnectionType, // Union of all connection types
446
+ EventType, // Union of all event types
447
+ } from './types/ontology';
448
+
449
+ // Type arrays
450
+ import {
451
+ THING_TYPES, // string[] of all thing types
452
+ CONNECTION_TYPES, // string[] of all connection types
453
+ EVENT_TYPES, // string[] of all event types
454
+ } from './types/ontology';
455
+
456
+ // Type guards
457
+ import {
458
+ isThingType, // (value: string) => boolean
459
+ isConnectionType, // (value: string) => boolean
460
+ isEventType, // (value: string) => boolean
461
+ } from './types/ontology';
462
+
463
+ // Metadata
464
+ import {
465
+ ONTOLOGY_METADATA // { features, generatedAt, counts }
466
+ } from './types/ontology';
467
+ ```
468
+
469
+ ### Database Schema Types
470
+
471
+ ```typescript
472
+ // Convex auto-generated types
473
+ import type { Doc, Id } from './_generated/dataModel';
474
+
475
+ // Entity document
476
+ type Entity = Doc<'entities'>;
477
+ type EntityId = Id<'entities'>;
478
+
479
+ // Connection document
480
+ type Connection = Doc<'connections'>;
481
+
482
+ // Event document
483
+ type Event = Doc<'events'>;
484
+
485
+ // Group document
486
+ type Group = Doc<'groups'>;
487
+ ```
488
+
489
+ ---
490
+
491
+ ## Troubleshooting
492
+
493
+ ### Issue: Types not generating
494
+
495
+ **Solution:**
496
+ ```bash
497
+ # Check YAML syntax
498
+ bun run backend/scripts/validate-ontology.ts
499
+
500
+ # Regenerate types
501
+ PUBLIC_FEATURES="myfeature" bun run backend/scripts/generate-ontology-types.ts
502
+
503
+ # Check output file
504
+ cat backend/convex/types/ontology.ts
505
+ ```
506
+
507
+ ### Issue: Invalid type errors
508
+
509
+ **Solution:**
510
+ ```typescript
511
+ // Always use type guards
512
+ if (!isThingType(args.type)) {
513
+ throw new Error(`Invalid type: ${args.type}`);
514
+ }
515
+
516
+ // Or validate against array
517
+ if (!THING_TYPES.includes(args.type)) {
518
+ throw new Error(`Invalid type: ${args.type}`);
519
+ }
520
+ ```
521
+
522
+ ### Issue: Circular dependencies
523
+
524
+ **Solution:**
525
+ ```yaml
526
+ # Feature A
527
+ feature: featureA
528
+ extends: core
529
+
530
+ # Feature B
531
+ feature: featureB
532
+ extends: core
533
+
534
+ # Integration feature (extends both)
535
+ feature: featureAB
536
+ extends: featureA,featureB
537
+ ```
538
+
539
+ ### Issue: Missing core types
540
+
541
+ **Solution:**
542
+ ```yaml
543
+ # Always extend core
544
+ extends: core
545
+
546
+ # Reference core types in connections
547
+ connectionTypes:
548
+ - name: my_connection
549
+ fromType: creator # From core
550
+ toType: my_thing # From this feature
551
+ ```
552
+
553
+ ### Issue: Performance with many types
554
+
555
+ **Solution:**
556
+ ```typescript
557
+ // Cache type sets for O(1) lookup
558
+ const THING_TYPE_SET = new Set(THING_TYPES);
559
+
560
+ export function isValidType(type: string): boolean {
561
+ return THING_TYPE_SET.has(type);
562
+ }
563
+ ```
564
+
565
+ ---
566
+
567
+ ## Best Practices
568
+
569
+ 1. **Always extend core** - Every feature should `extends: core`
570
+ 2. **Use descriptive names** - `blog_post` not `post`
571
+ 3. **Add examples** - Include example objects in YAML
572
+ 4. **Validate inputs** - Use type guards for runtime validation
573
+ 5. **Log events** - Track all significant actions
574
+ 6. **Test thoroughly** - Write tests for mutations and queries
575
+ 7. **Version properly** - Use semantic versioning (1.0.0)
576
+ 8. **Document metadata** - Explain what goes in metadata fields
577
+ 9. **Keep features focused** - One feature, one purpose
578
+ 10. **Compose features** - Create integration features for cross-feature logic
579
+
580
+ ---
581
+
582
+ ## Quick Links
583
+
584
+ - [Complete Tutorial](/one/knowledge/ontology-tutorial.md)
585
+ - [Ontology Specification](/one/knowledge/ontology.md)
586
+ - [Engineering Guide](/one/knowledge/ontology-engineering.md)
587
+ - [Example Code](/backend/examples/ontology-types-usage.ts)
588
+
589
+ ---
590
+
591
+ **Last Updated:** 2025-01-20
@@ -0,0 +1,42 @@
1
+ feature: community
2
+ extends: core
3
+ description: Forums, discussions, and direct messaging
4
+
5
+ thingTypes:
6
+ - name: forum_topic
7
+ properties:
8
+ title: string
9
+ slug: string
10
+ content: string
11
+ isPinned: boolean
12
+ isLocked: boolean
13
+ viewCount: number
14
+ replyCount: number
15
+ - name: forum_reply
16
+ properties:
17
+ content: string
18
+ topicId: string
19
+ replyToId: string
20
+ - name: direct_message
21
+ properties:
22
+ content: string
23
+ recipientId: string
24
+ readAt: number
25
+
26
+ connectionTypes:
27
+ - name: follows
28
+ fromType: user
29
+ toType: user
30
+ - name: member_of
31
+ fromType: user
32
+ toType: group
33
+
34
+ eventTypes:
35
+ - name: topic_created
36
+ thingType: forum_topic
37
+ - name: topic_replied
38
+ thingType: forum_reply
39
+ - name: message_sent
40
+ thingType: direct_message
41
+ - name: user_followed
42
+ thingType: user