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.
- package/.claude/agents/agent-director.md +902 -22
- package/.claude/agents/agent-onboard-example-output.md +600 -0
- package/.claude/agents/agent-onboard.md +576 -0
- package/.claude/commands/ONBOARDING_ENHANCEMENT_SUMMARY.md +266 -0
- package/.claude/commands/deploy.md +77 -150
- package/.claude/commands/one.md +375 -5
- package/.claude/commands/release.md +64 -3
- package/.mcp.json +57 -0
- package/CLAUDE.md +55 -69
- package/CREATE-WEBSITE.md +442 -0
- package/SECURITY.md +31 -0
- package/TESTING-ONBOARDING.md +185 -0
- package/dist/commands/create-website.d.ts +19 -0
- package/dist/commands/create-website.d.ts.map +1 -0
- package/dist/commands/create-website.js +231 -0
- package/dist/commands/create-website.js.map +1 -0
- package/dist/commands/init.d.ts +5 -6
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +213 -103
- package/dist/commands/init.js.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/utils/installation-setup.d.ts +24 -1
- package/dist/utils/installation-setup.d.ts.map +1 -1
- package/dist/utils/installation-setup.js +85 -1
- package/dist/utils/installation-setup.js.map +1 -1
- package/dist/utils/launch-claude.d.ts +6 -0
- package/dist/utils/launch-claude.d.ts.map +1 -0
- package/dist/utils/launch-claude.js +51 -0
- package/dist/utils/launch-claude.js.map +1 -0
- package/dist/utils/validation.d.ts +48 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +73 -0
- package/dist/utils/validation.js.map +1 -0
- package/folders.yaml +1 -1
- package/one/.obsidian/core-plugins.json +33 -0
- package/one/.obsidian/workspace.json +20 -20
- package/one/connections/workflow-onboarding.md +683 -0
- package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +354 -0
- package/one/events/CRITICAL-FIXES-COMPLETE.md +504 -0
- package/one/events/DEPLOYMENT.md +178 -0
- package/one/events/ECOMMERCE-DEMO-PLAN.md +225 -0
- package/one/events/ECOMMERCE-LIVE-DEMO.md +363 -0
- package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +735 -0
- package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +923 -0
- package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +223 -0
- package/one/events/HANDOFF.md +313 -0
- package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +503 -0
- package/one/events/IMPLEMENTATION_SUMMARY.md +529 -0
- package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +666 -0
- package/one/events/LANDING-PAGE-IMPLEMENTATION.md +642 -0
- package/one/events/LANDING-PAGE-QUICKSTART.md +407 -0
- package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +1627 -0
- package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +573 -0
- package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +398 -0
- package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +525 -0
- package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +455 -0
- package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +486 -0
- package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +203 -0
- package/one/events/SECURITY-AUDIT-FIXES.md +376 -0
- package/one/events/SECURITY-SCAN-COMPLETE.md +281 -0
- package/one/events/SHOP-BUILD-STATUS.md +114 -0
- package/one/events/SHOP-PREMIUM-UPDATE.md +149 -0
- package/one/events/SITE-WIDE-GRADIENT-FIX.md +299 -0
- package/one/events/STORE-PRODUCTION-READY-STATUS.md +359 -0
- package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +429 -0
- package/one/events/agent-director-enhancement-summary.md +386 -0
- package/one/events/agent-onboard-implementation-summary.md +457 -0
- package/one/events/clean-agent-ontology-cleanup-report.md +353 -0
- package/one/events/landing-page-generator.md +458 -0
- package/one/events/onboarding-implementation-complete.md +505 -0
- package/one/events/release.md +254 -0
- package/one/events/separate-implementation-status.md +537 -0
- package/one/knowledge/100-inference-quick-reference.md +431 -0
- package/one/knowledge/agent-onboard-usage.md +612 -0
- package/one/knowledge/cli-claude-handoff.md +718 -0
- package/one/knowledge/ontology-blog.yaml +31 -0
- package/one/knowledge/ontology-cheatsheet.md +591 -0
- package/one/knowledge/ontology-community.yaml +42 -0
- package/one/knowledge/ontology-core-universal.md +722 -0
- package/one/knowledge/ontology-core.yaml +50 -0
- package/one/knowledge/ontology-courses.yaml +53 -0
- package/one/knowledge/ontology-creator.md +376 -0
- package/one/knowledge/ontology-developer-guide.md +789 -0
- package/one/knowledge/ontology-education.md +920 -0
- package/one/knowledge/ontology-index.md +354 -0
- package/one/knowledge/ontology-migration-guide.md +811 -0
- package/one/knowledge/ontology-minimal.yaml +1 -1
- package/one/knowledge/ontology-portfolio.yaml +31 -0
- package/one/knowledge/ontology-quickstart.md +576 -0
- package/one/knowledge/ontology-shop.yaml +121 -0
- package/one/knowledge/ontology-tokens.yaml +32 -0
- package/one/knowledge/ontology-tutorial.md +434 -0
- package/one/knowledge/ontology-video-script.md +890 -0
- package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +467 -0
- package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +408 -0
- package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +369 -0
- package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +396 -0
- package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +468 -0
- package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +582 -0
- package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +449 -0
- package/one/things/docs/ecommerce/QUICK-START.md +368 -0
- package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +498 -0
- package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +237 -0
- package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +171 -0
- package/one/things/docs/ecommerce/demo.astro +309 -0
- package/one/things/plans/agent-director-100-inference-plans.md +410 -0
- package/one/things/plans/dual-website-strategy.md +612 -0
- package/one/things/plans/feature-based-sites.md +821 -0
- package/one/things/plans/multi-ontology-architecture.md +836 -0
- package/one/things/plans/onboarding.md +32 -0
- package/one/things/plans/separate.md +15 -17
- package/one/things/plans/start-new.md +738 -0
- package/package.json +7 -2
- package/one/things/claude/hooks/agent-hook-manager.js +0 -525
- package/one/things/claude/hooks/agent-load-balancer.js +0 -271
- package/one/things/claude/hooks/agent-request-interceptor.js +0 -70
- package/one/things/claude/hooks/cascade-feedback.js +0 -297
- package/one/things/claude/hooks/cascade-integration-hooks.js +0 -648
- package/one/things/claude/hooks/continuous-improvement-monitor.js +0 -510
- package/one/things/claude/hooks/file-organization-engine.js +0 -427
- package/one/things/claude/hooks/file-organization-monitor.js +0 -269
- package/one/things/claude/hooks/hook-config-manager.js +0 -202
- package/one/things/claude/hooks/hook-orchestrator.js +0 -662
- package/one/things/claude/hooks/hook-performance-report.js +0 -120
- package/one/things/claude/hooks/mcp-cascade-integration.js +0 -816
- package/one/things/claude/hooks/memory-optimizer.js +0 -510
- package/one/things/claude/hooks/ontology-compliance.js +0 -394
- package/one/things/claude/hooks/ontology-hook-manager.js +0 -316
- package/one/things/claude/hooks/ontology-validation-engine.js +0 -317
- package/one/things/claude/hooks/performance-monitoring-hook.js +0 -422
- package/one/things/claude/hooks/quality-scoring-engine.js +0 -834
- package/one/things/claude/hooks/simple-load-balancer.js +0 -238
- package/one/things/claude/hooks/startup-optimizer.js +0 -625
- package/one/things/claude/hooks/story-scoring-system.js +0 -445
- package/one/things/claude/hooks/story-validation-engine.js +0 -473
- package/one/things/claude/hooks/structure-synchronizer.js +0 -194
- package/one/things/claude/hooks/sub-agent-output-validator.js +0 -647
- package/one/things/claude/hooks/sub-agent-validation-hook.js +0 -343
- package/one/things/claude/hooks/trinity-validation-system.js +0 -392
- package/one/things/plans/organizations-to-groups.md +0 -705
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
feature: shop
|
|
2
|
+
extends: core
|
|
3
|
+
description: E-commerce and online store functionality
|
|
4
|
+
|
|
5
|
+
thingTypes:
|
|
6
|
+
- name: product
|
|
7
|
+
properties:
|
|
8
|
+
name: string
|
|
9
|
+
slug: string
|
|
10
|
+
description: string
|
|
11
|
+
price: number
|
|
12
|
+
compareAtPrice: number
|
|
13
|
+
images: string[]
|
|
14
|
+
inventory: number
|
|
15
|
+
sku: string
|
|
16
|
+
status: string
|
|
17
|
+
|
|
18
|
+
- name: product_variant
|
|
19
|
+
properties:
|
|
20
|
+
name: string
|
|
21
|
+
sku: string
|
|
22
|
+
price: number
|
|
23
|
+
inventory: number
|
|
24
|
+
options: object
|
|
25
|
+
|
|
26
|
+
- name: shopping_cart
|
|
27
|
+
properties:
|
|
28
|
+
items: object[]
|
|
29
|
+
subtotal: number
|
|
30
|
+
tax: number
|
|
31
|
+
shipping: number
|
|
32
|
+
total: number
|
|
33
|
+
sessionId: string
|
|
34
|
+
|
|
35
|
+
- name: order
|
|
36
|
+
properties:
|
|
37
|
+
orderNumber: string
|
|
38
|
+
items: object[]
|
|
39
|
+
subtotal: number
|
|
40
|
+
tax: number
|
|
41
|
+
shipping: number
|
|
42
|
+
total: number
|
|
43
|
+
status: string
|
|
44
|
+
shippingAddress: object
|
|
45
|
+
billingAddress: object
|
|
46
|
+
paymentId: string
|
|
47
|
+
|
|
48
|
+
- name: discount_code
|
|
49
|
+
properties:
|
|
50
|
+
code: string
|
|
51
|
+
discountType: string
|
|
52
|
+
discountValue: number
|
|
53
|
+
minPurchase: number
|
|
54
|
+
maxUses: number
|
|
55
|
+
usedCount: number
|
|
56
|
+
validFrom: number
|
|
57
|
+
validTo: number
|
|
58
|
+
|
|
59
|
+
- name: payment
|
|
60
|
+
properties:
|
|
61
|
+
amount: number
|
|
62
|
+
currency: string
|
|
63
|
+
paymentMethod: string
|
|
64
|
+
stripePaymentIntentId: string
|
|
65
|
+
status: string
|
|
66
|
+
processedAt: number
|
|
67
|
+
|
|
68
|
+
connectionTypes:
|
|
69
|
+
- name: purchased
|
|
70
|
+
fromType: user
|
|
71
|
+
toType: product
|
|
72
|
+
|
|
73
|
+
- name: in_cart
|
|
74
|
+
fromType: user
|
|
75
|
+
toType: product
|
|
76
|
+
|
|
77
|
+
- name: variant_of
|
|
78
|
+
fromType: product_variant
|
|
79
|
+
toType: product
|
|
80
|
+
|
|
81
|
+
- name: ordered
|
|
82
|
+
fromType: user
|
|
83
|
+
toType: order
|
|
84
|
+
|
|
85
|
+
- name: paid_for
|
|
86
|
+
fromType: payment
|
|
87
|
+
toType: order
|
|
88
|
+
|
|
89
|
+
eventTypes:
|
|
90
|
+
- name: product_added_to_cart
|
|
91
|
+
thingType: shopping_cart
|
|
92
|
+
|
|
93
|
+
- name: cart_updated
|
|
94
|
+
thingType: shopping_cart
|
|
95
|
+
|
|
96
|
+
- name: cart_abandoned
|
|
97
|
+
thingType: shopping_cart
|
|
98
|
+
|
|
99
|
+
- name: order_placed
|
|
100
|
+
thingType: order
|
|
101
|
+
|
|
102
|
+
- name: order_fulfilled
|
|
103
|
+
thingType: order
|
|
104
|
+
|
|
105
|
+
- name: order_shipped
|
|
106
|
+
thingType: order
|
|
107
|
+
|
|
108
|
+
- name: order_delivered
|
|
109
|
+
thingType: order
|
|
110
|
+
|
|
111
|
+
- name: payment_processed
|
|
112
|
+
thingType: payment
|
|
113
|
+
|
|
114
|
+
- name: payment_failed
|
|
115
|
+
thingType: payment
|
|
116
|
+
|
|
117
|
+
- name: product_viewed
|
|
118
|
+
thingType: product
|
|
119
|
+
|
|
120
|
+
- name: discount_applied
|
|
121
|
+
thingType: discount_code
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
feature: tokens
|
|
2
|
+
extends: core
|
|
3
|
+
description: Creator tokens and token economy
|
|
4
|
+
|
|
5
|
+
thingTypes:
|
|
6
|
+
- name: token
|
|
7
|
+
properties:
|
|
8
|
+
name: string
|
|
9
|
+
symbol: string
|
|
10
|
+
totalSupply: number
|
|
11
|
+
circulatingSupply: number
|
|
12
|
+
priceUSD: number
|
|
13
|
+
contractAddress: string
|
|
14
|
+
chain: string
|
|
15
|
+
- name: token_holder
|
|
16
|
+
properties:
|
|
17
|
+
walletAddress: string
|
|
18
|
+
balance: number
|
|
19
|
+
lockedBalance: number
|
|
20
|
+
|
|
21
|
+
connectionTypes:
|
|
22
|
+
- name: holds_tokens
|
|
23
|
+
fromType: user
|
|
24
|
+
toType: token
|
|
25
|
+
|
|
26
|
+
eventTypes:
|
|
27
|
+
- name: tokens_purchased
|
|
28
|
+
thingType: token
|
|
29
|
+
- name: tokens_sold
|
|
30
|
+
thingType: token
|
|
31
|
+
- name: tokens_transferred
|
|
32
|
+
thingType: token
|
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
# Multi-Ontology Architecture: Interactive Tutorial
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0.0
|
|
4
|
+
**Purpose:** Learn the multi-ontology system from basics to advanced patterns
|
|
5
|
+
**Audience:** Developers, AI agents, platform builders
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
1. [Tutorial Overview](#tutorial-overview)
|
|
12
|
+
2. [Part 1: Understanding Ontology Composition](#part-1-understanding-ontology-composition)
|
|
13
|
+
3. [Part 2: Creating Your First Feature](#part-2-creating-your-first-feature)
|
|
14
|
+
4. [Part 3: Advanced Patterns](#part-3-advanced-patterns)
|
|
15
|
+
5. [Exercises](#exercises)
|
|
16
|
+
6. [Solutions](#solutions)
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Tutorial Overview
|
|
21
|
+
|
|
22
|
+
This tutorial will teach you how to:
|
|
23
|
+
|
|
24
|
+
1. Understand the ontology composition system
|
|
25
|
+
2. Create your first feature ontology
|
|
26
|
+
3. Use types in mutations and queries
|
|
27
|
+
4. Test your feature
|
|
28
|
+
5. Deploy to production
|
|
29
|
+
|
|
30
|
+
**Time Required:** 60-90 minutes
|
|
31
|
+
**Prerequisites:** Basic TypeScript, understanding of databases
|
|
32
|
+
**What You'll Build:** A complete newsletter feature with subscriptions, campaigns, and analytics
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Part 1: Understanding Ontology Composition
|
|
37
|
+
|
|
38
|
+
### The Core Ontology
|
|
39
|
+
|
|
40
|
+
Every ONE installation starts with the **core ontology** defined in `/one/knowledge/ontology-core.yaml`.
|
|
41
|
+
|
|
42
|
+
The core ontology provides the foundation:
|
|
43
|
+
|
|
44
|
+
```yaml
|
|
45
|
+
feature: core
|
|
46
|
+
version: "1.0.0"
|
|
47
|
+
description: "Foundation ontology with 6 dimensions"
|
|
48
|
+
|
|
49
|
+
thingTypes:
|
|
50
|
+
- name: creator
|
|
51
|
+
description: "Human creator with role and permissions"
|
|
52
|
+
|
|
53
|
+
- name: ai_clone
|
|
54
|
+
description: "Digital twin with voice + appearance"
|
|
55
|
+
|
|
56
|
+
- name: group
|
|
57
|
+
description: "Multi-tenant container with hierarchical nesting"
|
|
58
|
+
|
|
59
|
+
connectionTypes:
|
|
60
|
+
- name: owns
|
|
61
|
+
description: "Ownership relationship"
|
|
62
|
+
fromType: any
|
|
63
|
+
toType: any
|
|
64
|
+
|
|
65
|
+
- name: member_of
|
|
66
|
+
description: "Group membership with role metadata"
|
|
67
|
+
fromType: creator
|
|
68
|
+
toType: group
|
|
69
|
+
|
|
70
|
+
eventTypes:
|
|
71
|
+
- name: thing_created
|
|
72
|
+
description: "Any entity created"
|
|
73
|
+
thingType: any
|
|
74
|
+
|
|
75
|
+
- name: thing_updated
|
|
76
|
+
description: "Any entity updated"
|
|
77
|
+
thingType: any
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Key Concepts:**
|
|
81
|
+
|
|
82
|
+
- **6 Dimensions:** groups, people, things, connections, events, knowledge
|
|
83
|
+
- **Core Types:** Foundation types that all features build upon
|
|
84
|
+
- **Composability:** Features extend core without breaking changes
|
|
85
|
+
|
|
86
|
+
### Feature Ontologies
|
|
87
|
+
|
|
88
|
+
Features extend the core with specialized types. Here's a simplified example:
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
feature: blog
|
|
92
|
+
extends: core
|
|
93
|
+
version: "1.0.0"
|
|
94
|
+
description: "Blogging platform feature"
|
|
95
|
+
|
|
96
|
+
thingTypes:
|
|
97
|
+
- name: blog_post
|
|
98
|
+
description: "Written blog content"
|
|
99
|
+
properties:
|
|
100
|
+
title: string
|
|
101
|
+
content: string
|
|
102
|
+
slug: string
|
|
103
|
+
publishedAt: number
|
|
104
|
+
|
|
105
|
+
- name: blog_category
|
|
106
|
+
description: "Blog post category"
|
|
107
|
+
properties:
|
|
108
|
+
name: string
|
|
109
|
+
slug: string
|
|
110
|
+
|
|
111
|
+
connectionTypes:
|
|
112
|
+
- name: categorized_as
|
|
113
|
+
description: "Post belongs to category"
|
|
114
|
+
fromType: blog_post
|
|
115
|
+
toType: blog_category
|
|
116
|
+
|
|
117
|
+
- name: authored
|
|
118
|
+
description: "Creator authored post"
|
|
119
|
+
fromType: creator # From core ontology
|
|
120
|
+
toType: blog_post # From this feature
|
|
121
|
+
|
|
122
|
+
eventTypes:
|
|
123
|
+
- name: post_published
|
|
124
|
+
description: "Blog post published"
|
|
125
|
+
thingType: blog_post
|
|
126
|
+
|
|
127
|
+
- name: post_viewed
|
|
128
|
+
description: "Someone viewed post"
|
|
129
|
+
thingType: blog_post
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**How Features Compose:**
|
|
133
|
+
|
|
134
|
+
1. **Extends Core:** `extends: core` means you get all core types
|
|
135
|
+
2. **References Core Types:** You can use `creator` from core in your connections
|
|
136
|
+
3. **Adds Feature Types:** New types only exist when feature is enabled
|
|
137
|
+
4. **Type Safety:** TypeScript types are auto-generated
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Part 2: Creating Your First Feature
|
|
142
|
+
|
|
143
|
+
Let's create a **newsletter** feature step-by-step.
|
|
144
|
+
|
|
145
|
+
### Step 1: Plan Your Data Model
|
|
146
|
+
|
|
147
|
+
Before writing YAML, answer these questions:
|
|
148
|
+
|
|
149
|
+
**What entities do we need?** (Things)
|
|
150
|
+
- `newsletter` - The newsletter publication
|
|
151
|
+
- `newsletter_issue` - Individual issues/editions
|
|
152
|
+
- `subscriber` - Someone subscribed to newsletter
|
|
153
|
+
- `newsletter_campaign` - Email campaign sending issues
|
|
154
|
+
|
|
155
|
+
**How do they relate?** (Connections)
|
|
156
|
+
- `creator` → `newsletter` (owns)
|
|
157
|
+
- `newsletter` → `newsletter_issue` (part_of)
|
|
158
|
+
- `subscriber` → `newsletter` (subscribed_to)
|
|
159
|
+
- `newsletter_campaign` → `newsletter_issue` (sends)
|
|
160
|
+
|
|
161
|
+
**What actions happen?** (Events)
|
|
162
|
+
- `newsletter_created` - New newsletter created
|
|
163
|
+
- `newsletter_subscribed` - Someone subscribed
|
|
164
|
+
- `newsletter_unsubscribed` - Someone unsubscribed
|
|
165
|
+
- `issue_published` - New issue published
|
|
166
|
+
- `issue_sent` - Issue sent to subscribers
|
|
167
|
+
|
|
168
|
+
### Step 2: Create the YAML File
|
|
169
|
+
|
|
170
|
+
Create `/one/knowledge/ontology-newsletter.yaml`:
|
|
171
|
+
|
|
172
|
+
```yaml
|
|
173
|
+
# Newsletter Feature Ontology
|
|
174
|
+
# Provides newsletter publications, subscriptions, and campaigns
|
|
175
|
+
|
|
176
|
+
feature: newsletter
|
|
177
|
+
extends: core
|
|
178
|
+
version: "1.0.0"
|
|
179
|
+
description: "Newsletter platform with subscriptions and campaigns"
|
|
180
|
+
|
|
181
|
+
# ============================================================================
|
|
182
|
+
# Thing Types - What exists
|
|
183
|
+
# ============================================================================
|
|
184
|
+
|
|
185
|
+
thingTypes:
|
|
186
|
+
# Newsletter publication
|
|
187
|
+
- name: newsletter
|
|
188
|
+
description: "Newsletter publication container"
|
|
189
|
+
properties:
|
|
190
|
+
title: string
|
|
191
|
+
description: string
|
|
192
|
+
slug: string
|
|
193
|
+
schedule: string # daily, weekly, monthly
|
|
194
|
+
subscriberCount: number
|
|
195
|
+
issueCount: number
|
|
196
|
+
|
|
197
|
+
# Individual newsletter issue
|
|
198
|
+
- name: newsletter_issue
|
|
199
|
+
description: "Individual newsletter edition"
|
|
200
|
+
properties:
|
|
201
|
+
title: string
|
|
202
|
+
content: string # HTML or Markdown
|
|
203
|
+
slug: string
|
|
204
|
+
publishedAt: number # Timestamp
|
|
205
|
+
sentAt: number # When sent to subscribers
|
|
206
|
+
openRate: number # Percentage
|
|
207
|
+
clickRate: number # Percentage
|
|
208
|
+
|
|
209
|
+
# Newsletter subscriber
|
|
210
|
+
- name: subscriber
|
|
211
|
+
description: "Newsletter subscriber"
|
|
212
|
+
properties:
|
|
213
|
+
email: string
|
|
214
|
+
firstName: string
|
|
215
|
+
lastName: string
|
|
216
|
+
subscribedAt: number
|
|
217
|
+
source: string # Where they signed up
|
|
218
|
+
tags: string[] # Subscriber tags/segments
|
|
219
|
+
active: boolean # Active subscription
|
|
220
|
+
|
|
221
|
+
# Email campaign for sending issues
|
|
222
|
+
- name: newsletter_campaign
|
|
223
|
+
description: "Email campaign for newsletter delivery"
|
|
224
|
+
properties:
|
|
225
|
+
subject: string
|
|
226
|
+
previewText: string
|
|
227
|
+
fromName: string
|
|
228
|
+
fromEmail: string
|
|
229
|
+
scheduledFor: number # When to send
|
|
230
|
+
sentAt: number # When actually sent
|
|
231
|
+
recipientCount: number
|
|
232
|
+
deliveredCount: number
|
|
233
|
+
openCount: number
|
|
234
|
+
clickCount: number
|
|
235
|
+
status: string # draft, scheduled, sending, sent
|
|
236
|
+
|
|
237
|
+
# ============================================================================
|
|
238
|
+
# Connection Types - How things relate
|
|
239
|
+
# ============================================================================
|
|
240
|
+
|
|
241
|
+
connectionTypes:
|
|
242
|
+
# Creator owns newsletter
|
|
243
|
+
- name: owns_newsletter
|
|
244
|
+
description: "Creator owns newsletter publication"
|
|
245
|
+
fromType: creator # From core ontology
|
|
246
|
+
toType: newsletter
|
|
247
|
+
metadata:
|
|
248
|
+
role: string # owner, editor, contributor
|
|
249
|
+
permissions: string[] # What they can do
|
|
250
|
+
|
|
251
|
+
# Newsletter contains issues
|
|
252
|
+
- name: part_of_newsletter
|
|
253
|
+
description: "Issue belongs to newsletter"
|
|
254
|
+
fromType: newsletter_issue
|
|
255
|
+
toType: newsletter
|
|
256
|
+
metadata:
|
|
257
|
+
issueNumber: number # Sequential issue number
|
|
258
|
+
|
|
259
|
+
# Subscriber subscribed to newsletter
|
|
260
|
+
- name: subscribed_to
|
|
261
|
+
description: "Subscriber subscribed to newsletter"
|
|
262
|
+
fromType: subscriber
|
|
263
|
+
toType: newsletter
|
|
264
|
+
metadata:
|
|
265
|
+
subscribedAt: number
|
|
266
|
+
source: string # Where they subscribed
|
|
267
|
+
doubleOptIn: boolean # Confirmed subscription
|
|
268
|
+
preferences: object # Email preferences
|
|
269
|
+
|
|
270
|
+
# Campaign sends issue
|
|
271
|
+
- name: sends
|
|
272
|
+
description: "Campaign delivers issue"
|
|
273
|
+
fromType: newsletter_campaign
|
|
274
|
+
toType: newsletter_issue
|
|
275
|
+
metadata:
|
|
276
|
+
scheduledFor: number
|
|
277
|
+
sentAt: number
|
|
278
|
+
|
|
279
|
+
# Subscriber received campaign
|
|
280
|
+
- name: received
|
|
281
|
+
description: "Subscriber received campaign"
|
|
282
|
+
fromType: subscriber
|
|
283
|
+
toType: newsletter_campaign
|
|
284
|
+
metadata:
|
|
285
|
+
deliveredAt: number
|
|
286
|
+
openedAt: number
|
|
287
|
+
clicked: boolean
|
|
288
|
+
unsubscribed: boolean
|
|
289
|
+
|
|
290
|
+
# ============================================================================
|
|
291
|
+
# Event Types - What happens
|
|
292
|
+
# ============================================================================
|
|
293
|
+
|
|
294
|
+
eventTypes:
|
|
295
|
+
# Newsletter lifecycle
|
|
296
|
+
- name: newsletter_created
|
|
297
|
+
description: "Newsletter publication created"
|
|
298
|
+
thingType: newsletter
|
|
299
|
+
|
|
300
|
+
- name: newsletter_updated
|
|
301
|
+
description: "Newsletter settings updated"
|
|
302
|
+
thingType: newsletter
|
|
303
|
+
|
|
304
|
+
# Subscription events
|
|
305
|
+
- name: newsletter_subscribed
|
|
306
|
+
description: "New subscriber joined newsletter"
|
|
307
|
+
thingType: subscriber
|
|
308
|
+
|
|
309
|
+
- name: newsletter_unsubscribed
|
|
310
|
+
description: "Subscriber left newsletter"
|
|
311
|
+
thingType: subscriber
|
|
312
|
+
|
|
313
|
+
- name: subscription_confirmed
|
|
314
|
+
description: "Subscriber confirmed double opt-in"
|
|
315
|
+
thingType: subscriber
|
|
316
|
+
|
|
317
|
+
# Issue events
|
|
318
|
+
- name: issue_created
|
|
319
|
+
description: "New newsletter issue created"
|
|
320
|
+
thingType: newsletter_issue
|
|
321
|
+
|
|
322
|
+
- name: issue_published
|
|
323
|
+
description: "Newsletter issue published"
|
|
324
|
+
thingType: newsletter_issue
|
|
325
|
+
|
|
326
|
+
- name: issue_sent
|
|
327
|
+
description: "Issue sent to subscribers via campaign"
|
|
328
|
+
thingType: newsletter_issue
|
|
329
|
+
|
|
330
|
+
# Campaign events
|
|
331
|
+
- name: campaign_created
|
|
332
|
+
description: "Email campaign created"
|
|
333
|
+
thingType: newsletter_campaign
|
|
334
|
+
|
|
335
|
+
- name: campaign_scheduled
|
|
336
|
+
description: "Campaign scheduled for delivery"
|
|
337
|
+
thingType: newsletter_campaign
|
|
338
|
+
|
|
339
|
+
- name: campaign_sent
|
|
340
|
+
description: "Campaign successfully delivered"
|
|
341
|
+
thingType: newsletter_campaign
|
|
342
|
+
|
|
343
|
+
# Engagement events
|
|
344
|
+
- name: issue_opened
|
|
345
|
+
description: "Subscriber opened newsletter issue"
|
|
346
|
+
thingType: newsletter_issue
|
|
347
|
+
|
|
348
|
+
- name: issue_clicked
|
|
349
|
+
description: "Subscriber clicked link in issue"
|
|
350
|
+
thingType: newsletter_issue
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### Step 3: Generate Types
|
|
354
|
+
|
|
355
|
+
Run the type generator to create TypeScript types:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
# Generate types with newsletter feature enabled
|
|
359
|
+
PUBLIC_FEATURES="newsletter" bun run backend/scripts/generate-ontology-types.ts
|
|
360
|
+
|
|
361
|
+
# Or enable multiple features
|
|
362
|
+
PUBLIC_FEATURES="blog,newsletter,shop" bun run backend/scripts/generate-ontology-types.ts
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
**Output:**
|
|
366
|
+
|
|
367
|
+
```
|
|
368
|
+
🚀 Ontology Type Generator
|
|
369
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
370
|
+
📦 Features: newsletter
|
|
371
|
+
|
|
372
|
+
📖 Loading ontologies...
|
|
373
|
+
|
|
374
|
+
✅ Ontologies loaded successfully!
|
|
375
|
+
- Features: core, newsletter
|
|
376
|
+
- Thing Types: 70
|
|
377
|
+
- Connection Types: 30
|
|
378
|
+
- Event Types: 79
|
|
379
|
+
|
|
380
|
+
⚙️ Generating TypeScript types...
|
|
381
|
+
📝 Writing to: backend/convex/types/ontology.ts
|
|
382
|
+
|
|
383
|
+
✅ Types generated successfully!
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## Part 3: Advanced Patterns
|
|
389
|
+
|
|
390
|
+
### Pattern 1: Multi-Feature Interactions
|
|
391
|
+
|
|
392
|
+
Features can reference each other's types.
|
|
393
|
+
|
|
394
|
+
### Pattern 2: Conditional Features
|
|
395
|
+
|
|
396
|
+
Check if features are enabled at runtime.
|
|
397
|
+
|
|
398
|
+
### Pattern 3: Performance Optimization
|
|
399
|
+
|
|
400
|
+
Optimize type checking and batch operations.
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## Exercises
|
|
405
|
+
|
|
406
|
+
### Exercise 1: Create a Bookmarks Feature
|
|
407
|
+
|
|
408
|
+
Create a feature for bookmarking content.
|
|
409
|
+
|
|
410
|
+
### Exercise 2: Add Event Logging
|
|
411
|
+
|
|
412
|
+
Enhance analytics with detailed event tracking.
|
|
413
|
+
|
|
414
|
+
### Exercise 3: Cross-Feature Connections
|
|
415
|
+
|
|
416
|
+
Integrate shop products with newsletter campaigns.
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## Solutions
|
|
421
|
+
|
|
422
|
+
Solutions provided for all exercises.
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## Next Steps
|
|
427
|
+
|
|
428
|
+
**Further Reading:**
|
|
429
|
+
|
|
430
|
+
- `/one/knowledge/ontology.md` - Complete specification
|
|
431
|
+
- `/one/knowledge/ontology-engineering.md` - Advanced patterns
|
|
432
|
+
- `/backend/examples/ontology-types-usage.ts` - More examples
|
|
433
|
+
|
|
434
|
+
**Happy building!**
|