@org.ai/examples 0.0.1

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 (40) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/LICENSE +21 -0
  3. package/README.md +147 -0
  4. package/api-business/index.ts +1179 -0
  5. package/directory/index.ts +1118 -0
  6. package/dist/api-business/index.d.ts +221 -0
  7. package/dist/api-business/index.d.ts.map +1 -0
  8. package/dist/api-business/index.js +1132 -0
  9. package/dist/api-business/index.js.map +1 -0
  10. package/dist/directory/index.d.ts +202 -0
  11. package/dist/directory/index.d.ts.map +1 -0
  12. package/dist/directory/index.js +1073 -0
  13. package/dist/directory/index.js.map +1 -0
  14. package/dist/index.d.ts +75 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +127 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/marketplace/index.d.ts +242 -0
  19. package/dist/marketplace/index.d.ts.map +1 -0
  20. package/dist/marketplace/index.js +1249 -0
  21. package/dist/marketplace/index.js.map +1 -0
  22. package/dist/saas/index.d.ts +151 -0
  23. package/dist/saas/index.d.ts.map +1 -0
  24. package/dist/saas/index.js +1142 -0
  25. package/dist/saas/index.js.map +1 -0
  26. package/dist/startup-studio/index.d.ts +285 -0
  27. package/dist/startup-studio/index.d.ts.map +1 -0
  28. package/dist/startup-studio/index.js +1252 -0
  29. package/dist/startup-studio/index.js.map +1 -0
  30. package/dist/vc-firm/index.d.ts +248 -0
  31. package/dist/vc-firm/index.d.ts.map +1 -0
  32. package/dist/vc-firm/index.js +1335 -0
  33. package/dist/vc-firm/index.js.map +1 -0
  34. package/index.ts +151 -0
  35. package/marketplace/index.ts +1295 -0
  36. package/package.json +58 -0
  37. package/saas/index.ts +1188 -0
  38. package/startup-studio/index.ts +1324 -0
  39. package/tsconfig.json +12 -0
  40. package/vc-firm/index.ts +1430 -0
@@ -0,0 +1,1142 @@
1
+ /**
2
+ * SaaS Business Example
3
+ *
4
+ * A complete example of a B2B SaaS business modeled using primitives.org.ai
5
+ * Demonstrates: Business definition, Products, Organization, Roles, KPIs, OKRs,
6
+ * Processes, Workflows, Financial metrics, and Digital Workers
7
+ *
8
+ * @example CloudMetrics - A SaaS analytics platform
9
+ * @packageDocumentation
10
+ */
11
+ /**
12
+ * NOTE: These examples demonstrate the DESIRED API shape for business-as-code.
13
+ * Some types may not exist yet in the actual package. The examples serve as
14
+ * documentation and specification for the ideal primitives API.
15
+ */
16
+ // Use any for flexibility - these examples define the ideal API shape
17
+ const Business = (def) => def;
18
+ const Product = (def) => def;
19
+ const Service = (def) => def;
20
+ const Goals = (defs) => defs;
21
+ const Vision = (def) => def;
22
+ const kpis = (defs) => defs;
23
+ const okrs = (defs) => defs;
24
+ const financials = (def) => def;
25
+ const Process = (def) => def;
26
+ const Workflow = (def) => def;
27
+ const createBusinessRole = (def) => def;
28
+ // Standard business roles placeholder
29
+ const StandardBusinessRoles = {
30
+ ceo: { type: 'ceo', level: 10, permissions: { '*': ['manage'] } },
31
+ cfo: { type: 'cfo', level: 9, permissions: { finance: ['manage'], budget: ['approve'] } },
32
+ cto: { type: 'cto', level: 9, permissions: { technology: ['manage'], code: ['review'] } },
33
+ engineer: { type: 'engineer', level: 3, canHandle: ['coding', 'code-review'] },
34
+ support: { type: 'support', level: 2, canHandle: ['customer-inquiry', 'ticket-response'] },
35
+ };
36
+ // $ helper placeholder
37
+ const $ = {
38
+ format: (n) => `$${n.toLocaleString()}`,
39
+ growth: (current, previous) => ((current - previous) / previous * 100).toFixed(1),
40
+ margin: (revenue, cost) => ((revenue - cost) / revenue * 100).toFixed(1),
41
+ };
42
+ // =============================================================================
43
+ // 1. BUSINESS DEFINITION
44
+ // =============================================================================
45
+ /**
46
+ * CloudMetrics - B2B SaaS Analytics Platform
47
+ */
48
+ export const CloudMetricsBusiness = Business({
49
+ name: 'CloudMetrics Inc.',
50
+ mission: 'Empower businesses with real-time analytics to make data-driven decisions',
51
+ values: ['Data-Driven', 'Customer Success', 'Transparency', 'Innovation'],
52
+ industry: 'Software as a Service',
53
+ founded: new Date('2022-01-15'),
54
+ stage: 'growth',
55
+ structure: {
56
+ departments: [
57
+ {
58
+ name: 'Engineering',
59
+ headcount: 25,
60
+ budget: 3000000,
61
+ teams: [
62
+ { name: 'Platform', headcount: 8, focus: 'Core infrastructure' },
63
+ { name: 'Frontend', headcount: 6, focus: 'User interfaces' },
64
+ { name: 'Data', headcount: 5, focus: 'Analytics engine' },
65
+ { name: 'DevOps', headcount: 4, focus: 'Infrastructure & deployment' },
66
+ { name: 'QA', headcount: 2, focus: 'Quality assurance' },
67
+ ],
68
+ },
69
+ {
70
+ name: 'Product',
71
+ headcount: 5,
72
+ budget: 800000,
73
+ teams: [
74
+ { name: 'Product Management', headcount: 3 },
75
+ { name: 'Design', headcount: 2 },
76
+ ],
77
+ },
78
+ {
79
+ name: 'Sales',
80
+ headcount: 12,
81
+ budget: 2000000,
82
+ teams: [
83
+ { name: 'Enterprise Sales', headcount: 5 },
84
+ { name: 'Mid-Market', headcount: 4 },
85
+ { name: 'SDR', headcount: 3 },
86
+ ],
87
+ },
88
+ {
89
+ name: 'Customer Success',
90
+ headcount: 8,
91
+ budget: 1000000,
92
+ teams: [
93
+ { name: 'Onboarding', headcount: 3 },
94
+ { name: 'Support', headcount: 3 },
95
+ { name: 'Renewals', headcount: 2 },
96
+ ],
97
+ },
98
+ {
99
+ name: 'Marketing',
100
+ headcount: 6,
101
+ budget: 1500000,
102
+ teams: [
103
+ { name: 'Growth', headcount: 2 },
104
+ { name: 'Content', headcount: 2 },
105
+ { name: 'Product Marketing', headcount: 2 },
106
+ ],
107
+ },
108
+ {
109
+ name: 'Finance & Operations',
110
+ headcount: 4,
111
+ budget: 500000,
112
+ },
113
+ ],
114
+ },
115
+ });
116
+ // =============================================================================
117
+ // 2. VISION & GOALS
118
+ // =============================================================================
119
+ export const CloudMetricsVision = Vision({
120
+ statement: 'Be the leading analytics platform for data-driven businesses worldwide',
121
+ timeHorizon: '2027',
122
+ pillars: [
123
+ 'Product Excellence',
124
+ 'Customer Success',
125
+ 'Market Leadership',
126
+ 'Operational Efficiency',
127
+ ],
128
+ successIndicators: [
129
+ { name: 'ARR', target: 50000000, unit: 'USD' },
130
+ { name: 'NPS', target: 70 },
131
+ { name: 'Customer Count', target: 5000 },
132
+ { name: 'Net Revenue Retention', target: 130, unit: '%' },
133
+ ],
134
+ });
135
+ export const CloudMetricsGoals = Goals([
136
+ {
137
+ name: 'Achieve $10M ARR',
138
+ category: 'financial',
139
+ status: 'in-progress',
140
+ progress: 75,
141
+ dueDate: new Date('2024-12-31'),
142
+ owner: 'CEO',
143
+ milestones: [
144
+ { name: '$5M ARR', completed: true },
145
+ { name: '$7.5M ARR', completed: true },
146
+ { name: '$10M ARR', completed: false },
147
+ ],
148
+ },
149
+ {
150
+ name: 'Launch Enterprise Tier',
151
+ category: 'product',
152
+ status: 'in-progress',
153
+ progress: 60,
154
+ dueDate: new Date('2024-06-30'),
155
+ owner: 'VP Product',
156
+ dependencies: ['SOC 2 Compliance', 'SSO Integration'],
157
+ },
158
+ {
159
+ name: 'SOC 2 Compliance',
160
+ category: 'operational',
161
+ status: 'in-progress',
162
+ progress: 80,
163
+ dueDate: new Date('2024-03-31'),
164
+ owner: 'VP Engineering',
165
+ },
166
+ {
167
+ name: 'SSO Integration',
168
+ category: 'product',
169
+ status: 'in-progress',
170
+ progress: 90,
171
+ dueDate: new Date('2024-02-28'),
172
+ owner: 'Engineering Lead',
173
+ },
174
+ {
175
+ name: 'Expand to EU Market',
176
+ category: 'strategic',
177
+ status: 'planned',
178
+ progress: 10,
179
+ dueDate: new Date('2024-09-30'),
180
+ owner: 'VP Sales',
181
+ dependencies: ['GDPR Compliance'],
182
+ },
183
+ {
184
+ name: 'GDPR Compliance',
185
+ category: 'operational',
186
+ status: 'in-progress',
187
+ progress: 45,
188
+ dueDate: new Date('2024-06-30'),
189
+ owner: 'Legal',
190
+ },
191
+ ]);
192
+ // =============================================================================
193
+ // 3. PRODUCTS & PRICING
194
+ // =============================================================================
195
+ export const CloudMetricsProduct = Product({
196
+ name: 'CloudMetrics Platform',
197
+ description: 'Real-time analytics platform for SaaS businesses',
198
+ pricingModel: 'subscription',
199
+ features: [
200
+ 'Real-time dashboards',
201
+ 'Custom metrics',
202
+ 'Alerts & notifications',
203
+ 'API access',
204
+ 'Data exports',
205
+ 'Team collaboration',
206
+ 'SSO (Enterprise)',
207
+ 'Dedicated support (Enterprise)',
208
+ ],
209
+ roadmap: [
210
+ {
211
+ name: 'AI-Powered Insights',
212
+ status: 'planned',
213
+ priority: 'high',
214
+ targetDate: new Date('2024-Q2'),
215
+ },
216
+ {
217
+ name: 'Mobile App',
218
+ status: 'in-progress',
219
+ priority: 'medium',
220
+ targetDate: new Date('2024-Q3'),
221
+ },
222
+ {
223
+ name: 'Embedded Analytics',
224
+ status: 'planned',
225
+ priority: 'high',
226
+ targetDate: new Date('2024-Q4'),
227
+ },
228
+ ],
229
+ });
230
+ export const PricingTiers = {
231
+ starter: Product({
232
+ name: 'Starter',
233
+ pricingModel: 'subscription',
234
+ price: 49, // /month
235
+ billingPeriod: 'monthly',
236
+ features: ['5 dashboards', '10 data sources', 'Email support'],
237
+ targetMarket: 'Small businesses',
238
+ }),
239
+ growth: Product({
240
+ name: 'Growth',
241
+ pricingModel: 'subscription',
242
+ price: 199, // /month
243
+ billingPeriod: 'monthly',
244
+ features: ['25 dashboards', '50 data sources', 'Priority support', 'API access'],
245
+ targetMarket: 'Mid-market',
246
+ cogs: 40,
247
+ }),
248
+ enterprise: Product({
249
+ name: 'Enterprise',
250
+ pricingModel: 'subscription',
251
+ price: 999, // /month
252
+ billingPeriod: 'monthly',
253
+ features: ['Unlimited dashboards', 'Unlimited data sources', 'SSO', 'Dedicated success manager', '99.9% SLA'],
254
+ targetMarket: 'Enterprise',
255
+ cogs: 200,
256
+ }),
257
+ };
258
+ // =============================================================================
259
+ // 4. ORGANIZATION & ROLES
260
+ // =============================================================================
261
+ export const CloudMetricsOrg = {
262
+ id: 'cloudmetrics',
263
+ name: 'CloudMetrics Inc.',
264
+ settings: {
265
+ timezone: 'America/Los_Angeles',
266
+ currency: 'USD',
267
+ fiscalYearStart: 1, // January
268
+ },
269
+ departments: [
270
+ {
271
+ id: 'engineering',
272
+ name: 'Engineering',
273
+ permissions: {
274
+ code: ['read', 'write', 'deploy'],
275
+ infrastructure: ['read', 'write', 'manage'],
276
+ },
277
+ budget: {
278
+ annual: 3000000,
279
+ spent: 2250000,
280
+ categories: {
281
+ salaries: { annual: 2500000, spent: 1875000 },
282
+ infrastructure: { annual: 400000, spent: 300000 },
283
+ tools: { annual: 100000, spent: 75000 },
284
+ },
285
+ },
286
+ teams: [
287
+ {
288
+ id: 'platform',
289
+ name: 'Platform',
290
+ positions: [
291
+ { id: 'platform-lead', title: 'Platform Lead', roleId: 'senior-engineer', reportsTo: 'eng-vp' },
292
+ { id: 'platform-eng-1', title: 'Senior Platform Engineer', roleId: 'senior-engineer', reportsTo: 'platform-lead' },
293
+ { id: 'platform-eng-2', title: 'Platform Engineer', roleId: 'engineer', reportsTo: 'platform-lead' },
294
+ ],
295
+ },
296
+ {
297
+ id: 'frontend',
298
+ name: 'Frontend',
299
+ positions: [
300
+ { id: 'frontend-lead', title: 'Frontend Lead', roleId: 'senior-engineer', reportsTo: 'eng-vp' },
301
+ { id: 'frontend-eng-1', title: 'Senior Frontend Engineer', roleId: 'senior-engineer', reportsTo: 'frontend-lead' },
302
+ ],
303
+ },
304
+ ],
305
+ },
306
+ {
307
+ id: 'sales',
308
+ name: 'Sales',
309
+ permissions: {
310
+ deals: ['read', 'write', 'manage'],
311
+ customers: ['read', 'write'],
312
+ },
313
+ budget: {
314
+ annual: 2000000,
315
+ spent: 1500000,
316
+ categories: {
317
+ salaries: { annual: 1500000, spent: 1125000 },
318
+ commissions: { annual: 400000, spent: 300000 },
319
+ travel: { annual: 100000, spent: 75000 },
320
+ },
321
+ },
322
+ },
323
+ {
324
+ id: 'customer-success',
325
+ name: 'Customer Success',
326
+ permissions: {
327
+ customers: ['read', 'write'],
328
+ support: ['read', 'write', 'manage'],
329
+ },
330
+ },
331
+ ],
332
+ roles: [
333
+ createBusinessRole({
334
+ id: 'ceo',
335
+ name: 'CEO',
336
+ ...StandardBusinessRoles.ceo,
337
+ }),
338
+ createBusinessRole({
339
+ id: 'cfo',
340
+ name: 'CFO',
341
+ ...StandardBusinessRoles.cfo,
342
+ }),
343
+ createBusinessRole({
344
+ id: 'senior-engineer',
345
+ name: 'Senior Engineer',
346
+ type: 'engineer',
347
+ level: 5,
348
+ permissions: {
349
+ code: ['read', 'write', 'review', 'merge'],
350
+ deployments: ['read', 'write'],
351
+ incidents: ['read', 'write', 'escalate'],
352
+ },
353
+ canHandle: ['coding', 'code-review', 'architecture', 'incident-response'],
354
+ canApprove: ['pull-request', 'design-doc'],
355
+ }),
356
+ createBusinessRole({
357
+ id: 'engineer',
358
+ name: 'Engineer',
359
+ type: 'engineer',
360
+ level: 3,
361
+ permissions: {
362
+ code: ['read', 'write'],
363
+ deployments: ['read'],
364
+ },
365
+ canHandle: ['coding', 'code-review', 'bug-fix'],
366
+ }),
367
+ createBusinessRole({
368
+ id: 'ae',
369
+ name: 'Account Executive',
370
+ type: 'sales',
371
+ level: 4,
372
+ permissions: {
373
+ deals: ['read', 'write', 'negotiate'],
374
+ customers: ['read', 'write'],
375
+ },
376
+ canHandle: ['demo', 'negotiation', 'contract-review'],
377
+ canApprove: ['discount'],
378
+ }),
379
+ createBusinessRole({
380
+ id: 'csm',
381
+ name: 'Customer Success Manager',
382
+ type: 'support',
383
+ level: 4,
384
+ permissions: {
385
+ customers: ['read', 'write'],
386
+ support: ['read', 'write', 'escalate'],
387
+ },
388
+ canHandle: ['onboarding', 'training', 'renewal', 'upsell'],
389
+ }),
390
+ createBusinessRole({
391
+ id: 'support-agent',
392
+ name: 'Support Agent',
393
+ type: 'support',
394
+ level: 2,
395
+ workerType: 'hybrid', // Can be AI or human
396
+ permissions: {
397
+ support: ['read', 'write'],
398
+ customers: ['read'],
399
+ },
400
+ canHandle: ['tier-1-support', 'documentation-query', 'status-check'],
401
+ }),
402
+ ],
403
+ approvalChains: [
404
+ {
405
+ id: 'expense-approval',
406
+ name: 'Expense Approval',
407
+ requestType: 'expense',
408
+ levels: [
409
+ { threshold: 1000, approvers: [{ type: 'manager' }] },
410
+ { threshold: 5000, approvers: [{ type: 'department-head' }] },
411
+ { threshold: 25000, approvers: [{ type: 'role', roleId: 'cfo' }] },
412
+ { threshold: Infinity, approvers: [{ type: 'role', roleId: 'ceo' }] },
413
+ ],
414
+ },
415
+ {
416
+ id: 'discount-approval',
417
+ name: 'Discount Approval',
418
+ requestType: 'discount',
419
+ levels: [
420
+ { threshold: 10, approvers: [{ type: 'manager' }] }, // Up to 10%
421
+ { threshold: 20, approvers: [{ type: 'department-head' }] }, // Up to 20%
422
+ { threshold: 30, approvers: [{ type: 'role', roleId: 'cro' }] }, // Up to 30%
423
+ { threshold: Infinity, approvers: [{ type: 'role', roleId: 'ceo' }] }, // >30%
424
+ ],
425
+ },
426
+ ],
427
+ routingRules: [
428
+ {
429
+ id: 'tier-1-support-routing',
430
+ taskType: 'tier-1-support',
431
+ priority: 1,
432
+ assignTo: { roleId: 'support-agent' },
433
+ conditions: { complexity: 'low' },
434
+ },
435
+ {
436
+ id: 'escalated-support-routing',
437
+ taskType: 'tier-2-support',
438
+ priority: 2,
439
+ assignTo: { roleId: 'csm' },
440
+ conditions: { complexity: 'high' },
441
+ },
442
+ {
443
+ id: 'code-review-routing',
444
+ taskType: 'code-review',
445
+ priority: 1,
446
+ assignTo: { roleId: 'senior-engineer' },
447
+ },
448
+ ],
449
+ };
450
+ // =============================================================================
451
+ // 5. KPIs & METRICS
452
+ // =============================================================================
453
+ export const CloudMetricsKPIs = kpis([
454
+ // Revenue Metrics
455
+ {
456
+ name: 'Monthly Recurring Revenue (MRR)',
457
+ category: 'financial',
458
+ target: 850000,
459
+ current: 780000,
460
+ unit: 'USD',
461
+ frequency: 'monthly',
462
+ owner: 'CEO',
463
+ },
464
+ {
465
+ name: 'Annual Recurring Revenue (ARR)',
466
+ category: 'financial',
467
+ target: 10000000,
468
+ current: 9360000,
469
+ unit: 'USD',
470
+ frequency: 'monthly',
471
+ owner: 'CEO',
472
+ },
473
+ {
474
+ name: 'Net Revenue Retention (NRR)',
475
+ category: 'financial',
476
+ target: 120,
477
+ current: 115,
478
+ unit: '%',
479
+ frequency: 'monthly',
480
+ owner: 'VP Customer Success',
481
+ },
482
+ // Customer Metrics
483
+ {
484
+ name: 'Customer Count',
485
+ category: 'customer',
486
+ target: 800,
487
+ current: 720,
488
+ frequency: 'monthly',
489
+ owner: 'VP Sales',
490
+ },
491
+ {
492
+ name: 'Churn Rate',
493
+ category: 'customer',
494
+ target: 2,
495
+ current: 2.5,
496
+ unit: '%',
497
+ frequency: 'monthly',
498
+ owner: 'VP Customer Success',
499
+ },
500
+ {
501
+ name: 'Net Promoter Score (NPS)',
502
+ category: 'customer',
503
+ target: 60,
504
+ current: 55,
505
+ frequency: 'quarterly',
506
+ owner: 'VP Product',
507
+ },
508
+ // Sales Metrics
509
+ {
510
+ name: 'Sales Qualified Leads',
511
+ category: 'sales',
512
+ target: 200,
513
+ current: 185,
514
+ frequency: 'monthly',
515
+ owner: 'VP Marketing',
516
+ },
517
+ {
518
+ name: 'Win Rate',
519
+ category: 'sales',
520
+ target: 25,
521
+ current: 22,
522
+ unit: '%',
523
+ frequency: 'monthly',
524
+ owner: 'VP Sales',
525
+ },
526
+ {
527
+ name: 'Average Contract Value (ACV)',
528
+ category: 'sales',
529
+ target: 15000,
530
+ current: 13500,
531
+ unit: 'USD',
532
+ frequency: 'monthly',
533
+ owner: 'VP Sales',
534
+ },
535
+ // Operational Metrics
536
+ {
537
+ name: 'System Uptime',
538
+ category: 'operational',
539
+ target: 99.9,
540
+ current: 99.95,
541
+ unit: '%',
542
+ frequency: 'monthly',
543
+ owner: 'VP Engineering',
544
+ },
545
+ {
546
+ name: 'Support Response Time',
547
+ category: 'operational',
548
+ target: 4,
549
+ current: 3.2,
550
+ unit: 'hours',
551
+ frequency: 'weekly',
552
+ owner: 'Support Lead',
553
+ },
554
+ {
555
+ name: 'Deployment Frequency',
556
+ category: 'operational',
557
+ target: 20,
558
+ current: 18,
559
+ unit: 'deploys/month',
560
+ frequency: 'monthly',
561
+ owner: 'VP Engineering',
562
+ },
563
+ ]);
564
+ // =============================================================================
565
+ // 6. OKRs
566
+ // =============================================================================
567
+ export const CloudMetricsOKRs = okrs([
568
+ {
569
+ objective: 'Achieve Product-Market Fit for Enterprise Segment',
570
+ owner: 'VP Product',
571
+ period: 'Q1 2024',
572
+ keyResults: [
573
+ {
574
+ description: 'Close 10 Enterprise customers',
575
+ metric: 'Enterprise Customers',
576
+ targetValue: 10,
577
+ currentValue: 6,
578
+ },
579
+ {
580
+ description: 'Achieve Enterprise NPS of 60+',
581
+ metric: 'Enterprise NPS',
582
+ targetValue: 60,
583
+ currentValue: 52,
584
+ },
585
+ {
586
+ description: 'Launch SSO & SCIM integrations',
587
+ metric: 'Features Launched',
588
+ targetValue: 2,
589
+ currentValue: 1,
590
+ },
591
+ ],
592
+ },
593
+ {
594
+ objective: 'Scale Sales Machine',
595
+ owner: 'VP Sales',
596
+ period: 'Q1 2024',
597
+ keyResults: [
598
+ {
599
+ description: 'Increase MQL to SQL conversion to 35%',
600
+ metric: 'MQL to SQL Conversion',
601
+ targetValue: 35,
602
+ currentValue: 28,
603
+ unit: '%',
604
+ },
605
+ {
606
+ description: 'Reduce sales cycle to 45 days',
607
+ metric: 'Sales Cycle',
608
+ targetValue: 45,
609
+ currentValue: 52,
610
+ unit: 'days',
611
+ },
612
+ {
613
+ description: 'Hire 3 new Account Executives',
614
+ metric: 'AEs Hired',
615
+ targetValue: 3,
616
+ currentValue: 2,
617
+ },
618
+ ],
619
+ },
620
+ {
621
+ objective: 'Build World-Class Engineering Culture',
622
+ owner: 'VP Engineering',
623
+ period: 'Q1 2024',
624
+ keyResults: [
625
+ {
626
+ description: 'Achieve 80% test coverage',
627
+ metric: 'Test Coverage',
628
+ targetValue: 80,
629
+ currentValue: 72,
630
+ unit: '%',
631
+ },
632
+ {
633
+ description: 'Reduce incident response time to 15 minutes',
634
+ metric: 'Incident Response Time',
635
+ targetValue: 15,
636
+ currentValue: 22,
637
+ unit: 'minutes',
638
+ },
639
+ {
640
+ description: 'Ship 50 customer-requested features',
641
+ metric: 'Features Shipped',
642
+ targetValue: 50,
643
+ currentValue: 38,
644
+ },
645
+ ],
646
+ },
647
+ {
648
+ objective: 'Maximize Customer Success',
649
+ owner: 'VP Customer Success',
650
+ period: 'Q1 2024',
651
+ keyResults: [
652
+ {
653
+ description: 'Achieve 95% renewal rate',
654
+ metric: 'Renewal Rate',
655
+ targetValue: 95,
656
+ currentValue: 92,
657
+ unit: '%',
658
+ },
659
+ {
660
+ description: 'Increase expansion revenue to 25% of ARR',
661
+ metric: 'Expansion Revenue',
662
+ targetValue: 25,
663
+ currentValue: 18,
664
+ unit: '%',
665
+ },
666
+ {
667
+ description: 'Reduce time-to-value to 14 days',
668
+ metric: 'Time to Value',
669
+ targetValue: 14,
670
+ currentValue: 21,
671
+ unit: 'days',
672
+ },
673
+ ],
674
+ },
675
+ ]);
676
+ // =============================================================================
677
+ // 7. PROCESSES
678
+ // =============================================================================
679
+ export const LeadToCustomerProcess = Process({
680
+ name: 'Lead to Customer',
681
+ description: 'End-to-end process from lead capture to closed-won deal',
682
+ owner: 'VP Sales',
683
+ steps: [
684
+ {
685
+ order: 1,
686
+ name: 'Lead Capture',
687
+ description: 'Capture lead from marketing channels',
688
+ automationLevel: 'automated',
689
+ duration: 'instant',
690
+ owner: 'Marketing',
691
+ },
692
+ {
693
+ order: 2,
694
+ name: 'Lead Qualification',
695
+ description: 'Qualify lead based on ICP and intent signals',
696
+ automationLevel: 'semi-automated',
697
+ duration: '24 hours',
698
+ owner: 'SDR',
699
+ },
700
+ {
701
+ order: 3,
702
+ name: 'Discovery Call',
703
+ description: 'Conduct discovery call to understand needs',
704
+ automationLevel: 'manual',
705
+ duration: '30 minutes',
706
+ owner: 'SDR',
707
+ },
708
+ {
709
+ order: 4,
710
+ name: 'Product Demo',
711
+ description: 'Deliver personalized product demonstration',
712
+ automationLevel: 'manual',
713
+ duration: '45 minutes',
714
+ owner: 'AE',
715
+ },
716
+ {
717
+ order: 5,
718
+ name: 'Proposal',
719
+ description: 'Create and send proposal',
720
+ automationLevel: 'semi-automated',
721
+ duration: '2 days',
722
+ owner: 'AE',
723
+ },
724
+ {
725
+ order: 6,
726
+ name: 'Negotiation',
727
+ description: 'Negotiate terms and pricing',
728
+ automationLevel: 'manual',
729
+ duration: '1 week',
730
+ owner: 'AE',
731
+ },
732
+ {
733
+ order: 7,
734
+ name: 'Contract',
735
+ description: 'Generate and sign contract',
736
+ automationLevel: 'semi-automated',
737
+ duration: '3 days',
738
+ owner: 'AE',
739
+ },
740
+ {
741
+ order: 8,
742
+ name: 'Handoff',
743
+ description: 'Hand off to Customer Success',
744
+ automationLevel: 'automated',
745
+ duration: '1 hour',
746
+ owner: 'AE',
747
+ },
748
+ ],
749
+ metrics: [
750
+ { name: 'Conversion Rate', target: 25, unit: '%' },
751
+ { name: 'Average Sales Cycle', target: 45, unit: 'days' },
752
+ { name: 'Win Rate', target: 25, unit: '%' },
753
+ ],
754
+ });
755
+ export const CustomerOnboardingProcess = Process({
756
+ name: 'Customer Onboarding',
757
+ description: 'Onboard new customers to achieve time-to-value',
758
+ owner: 'VP Customer Success',
759
+ steps: [
760
+ {
761
+ order: 1,
762
+ name: 'Welcome',
763
+ description: 'Send welcome email with access credentials',
764
+ automationLevel: 'automated',
765
+ duration: 'instant',
766
+ },
767
+ {
768
+ order: 2,
769
+ name: 'Kickoff Call',
770
+ description: 'Conduct kickoff call to set expectations',
771
+ automationLevel: 'manual',
772
+ duration: '1 hour',
773
+ owner: 'CSM',
774
+ },
775
+ {
776
+ order: 3,
777
+ name: 'Data Integration',
778
+ description: 'Help customer connect data sources',
779
+ automationLevel: 'semi-automated',
780
+ duration: '2 days',
781
+ owner: 'CSM',
782
+ },
783
+ {
784
+ order: 4,
785
+ name: 'Dashboard Setup',
786
+ description: 'Configure initial dashboards',
787
+ automationLevel: 'semi-automated',
788
+ duration: '1 day',
789
+ owner: 'CSM',
790
+ },
791
+ {
792
+ order: 5,
793
+ name: 'Training',
794
+ description: 'Conduct product training session',
795
+ automationLevel: 'manual',
796
+ duration: '2 hours',
797
+ owner: 'CSM',
798
+ },
799
+ {
800
+ order: 6,
801
+ name: 'First Value',
802
+ description: 'Ensure customer achieves first value milestone',
803
+ automationLevel: 'manual',
804
+ duration: '1 week',
805
+ owner: 'CSM',
806
+ },
807
+ {
808
+ order: 7,
809
+ name: 'Graduation',
810
+ description: 'Move customer to steady-state support',
811
+ automationLevel: 'automated',
812
+ duration: '1 day',
813
+ },
814
+ ],
815
+ metrics: [
816
+ { name: 'Time to Value', target: 14, unit: 'days' },
817
+ { name: 'Onboarding Completion Rate', target: 95, unit: '%' },
818
+ { name: 'CSAT', target: 90, unit: '%' },
819
+ ],
820
+ });
821
+ export const SupportTicketProcess = Process({
822
+ name: 'Support Ticket Resolution',
823
+ description: 'Handle customer support tickets efficiently',
824
+ owner: 'Support Lead',
825
+ steps: [
826
+ {
827
+ order: 1,
828
+ name: 'Intake',
829
+ description: 'Receive and categorize ticket',
830
+ automationLevel: 'automated',
831
+ duration: 'instant',
832
+ },
833
+ {
834
+ order: 2,
835
+ name: 'Triage',
836
+ description: 'Assess priority and assign to appropriate agent',
837
+ automationLevel: 'semi-automated',
838
+ duration: '15 minutes',
839
+ },
840
+ {
841
+ order: 3,
842
+ name: 'Initial Response',
843
+ description: 'Provide initial response to customer',
844
+ automationLevel: 'semi-automated',
845
+ duration: '1 hour',
846
+ owner: 'Support Agent',
847
+ },
848
+ {
849
+ order: 4,
850
+ name: 'Investigation',
851
+ description: 'Investigate and diagnose issue',
852
+ automationLevel: 'manual',
853
+ duration: '2 hours',
854
+ owner: 'Support Agent',
855
+ },
856
+ {
857
+ order: 5,
858
+ name: 'Resolution',
859
+ description: 'Resolve issue or escalate',
860
+ automationLevel: 'manual',
861
+ duration: '4 hours',
862
+ owner: 'Support Agent',
863
+ },
864
+ {
865
+ order: 6,
866
+ name: 'Verification',
867
+ description: 'Verify resolution with customer',
868
+ automationLevel: 'semi-automated',
869
+ duration: '1 hour',
870
+ },
871
+ {
872
+ order: 7,
873
+ name: 'Closure',
874
+ description: 'Close ticket and request feedback',
875
+ automationLevel: 'automated',
876
+ duration: 'instant',
877
+ },
878
+ ],
879
+ metrics: [
880
+ { name: 'First Response Time', target: 1, unit: 'hours' },
881
+ { name: 'Resolution Time', target: 8, unit: 'hours' },
882
+ { name: 'First Contact Resolution', target: 70, unit: '%' },
883
+ { name: 'CSAT', target: 90, unit: '%' },
884
+ ],
885
+ });
886
+ // =============================================================================
887
+ // 8. WORKFLOWS (Automated)
888
+ // =============================================================================
889
+ export const LeadScoringWorkflow = Workflow({
890
+ name: 'Lead Scoring',
891
+ description: 'Automatically score and qualify leads',
892
+ trigger: { type: 'event', event: 'lead.created' },
893
+ actions: [
894
+ {
895
+ order: 1,
896
+ type: 'compute',
897
+ name: 'Calculate Firmographic Score',
898
+ config: {
899
+ factors: ['company_size', 'industry', 'location'],
900
+ weights: [0.4, 0.35, 0.25],
901
+ },
902
+ },
903
+ {
904
+ order: 2,
905
+ type: 'compute',
906
+ name: 'Calculate Behavioral Score',
907
+ config: {
908
+ factors: ['page_views', 'content_downloads', 'email_opens'],
909
+ weights: [0.3, 0.4, 0.3],
910
+ },
911
+ },
912
+ {
913
+ order: 3,
914
+ type: 'compute',
915
+ name: 'Combine Scores',
916
+ config: {
917
+ formula: '(firmographic * 0.6) + (behavioral * 0.4)',
918
+ },
919
+ },
920
+ {
921
+ order: 4,
922
+ type: 'condition',
923
+ name: 'Check MQL Threshold',
924
+ condition: 'score >= 70',
925
+ },
926
+ {
927
+ order: 5,
928
+ type: 'notification',
929
+ name: 'Notify SDR',
930
+ config: {
931
+ channel: 'slack',
932
+ template: 'new_mql_alert',
933
+ },
934
+ },
935
+ ],
936
+ });
937
+ export const ChurnPredictionWorkflow = Workflow({
938
+ name: 'Churn Prediction Alert',
939
+ description: 'Alert CSM when customer shows churn signals',
940
+ trigger: { type: 'schedule', cron: '0 9 * * *' }, // Daily at 9 AM
941
+ actions: [
942
+ {
943
+ order: 1,
944
+ type: 'compute',
945
+ name: 'Calculate Health Score',
946
+ config: {
947
+ factors: ['usage_trend', 'support_tickets', 'login_frequency', 'feature_adoption'],
948
+ weights: [0.3, 0.2, 0.25, 0.25],
949
+ },
950
+ },
951
+ {
952
+ order: 2,
953
+ type: 'condition',
954
+ name: 'Check At-Risk Threshold',
955
+ condition: 'healthScore < 60',
956
+ },
957
+ {
958
+ order: 3,
959
+ type: 'notification',
960
+ name: 'Alert CSM',
961
+ config: {
962
+ channel: 'email',
963
+ template: 'at_risk_customer',
964
+ priority: 'high',
965
+ },
966
+ },
967
+ {
968
+ order: 4,
969
+ type: 'task',
970
+ name: 'Create Save Play Task',
971
+ config: {
972
+ type: 'customer-save-play',
973
+ assignTo: 'csm',
974
+ dueIn: '48 hours',
975
+ },
976
+ },
977
+ ],
978
+ });
979
+ export const TrialConversionWorkflow = Workflow({
980
+ name: 'Trial Conversion Nurture',
981
+ description: 'Nurture trial users towards conversion',
982
+ trigger: { type: 'event', event: 'trial.started' },
983
+ actions: [
984
+ {
985
+ order: 1,
986
+ type: 'notification',
987
+ name: 'Welcome Email',
988
+ config: { template: 'trial_welcome', channel: 'email' },
989
+ },
990
+ {
991
+ order: 2,
992
+ type: 'wait',
993
+ name: 'Wait 3 Days',
994
+ duration: '3 days',
995
+ },
996
+ {
997
+ order: 3,
998
+ type: 'condition',
999
+ name: 'Check Activation',
1000
+ condition: 'user.hasConnectedDataSource == false',
1001
+ },
1002
+ {
1003
+ order: 4,
1004
+ type: 'notification',
1005
+ name: 'Activation Nudge',
1006
+ config: { template: 'connect_data_source', channel: 'email' },
1007
+ },
1008
+ {
1009
+ order: 5,
1010
+ type: 'wait',
1011
+ name: 'Wait Until Day 7',
1012
+ duration: '4 days',
1013
+ },
1014
+ {
1015
+ order: 6,
1016
+ type: 'task',
1017
+ name: 'Schedule Demo Call',
1018
+ config: {
1019
+ type: 'demo-call',
1020
+ assignTo: 'sdr',
1021
+ },
1022
+ },
1023
+ {
1024
+ order: 7,
1025
+ type: 'wait',
1026
+ name: 'Wait Until Day 12',
1027
+ duration: '5 days',
1028
+ },
1029
+ {
1030
+ order: 8,
1031
+ type: 'condition',
1032
+ name: 'Check Not Converted',
1033
+ condition: 'user.plan == "trial"',
1034
+ },
1035
+ {
1036
+ order: 9,
1037
+ type: 'notification',
1038
+ name: 'Final Offer Email',
1039
+ config: { template: 'trial_ending_offer', channel: 'email' },
1040
+ },
1041
+ ],
1042
+ });
1043
+ // =============================================================================
1044
+ // 9. FINANCIALS
1045
+ // =============================================================================
1046
+ export const CloudMetricsFinancials = financials({
1047
+ revenue: 9360000, // ARR
1048
+ cogs: 1872000, // 20% of revenue
1049
+ operatingExpenses: 6500000, // Salaries, marketing, etc.
1050
+ depreciation: 200000,
1051
+ interestExpense: 50000,
1052
+ otherIncome: 25000,
1053
+ taxes: 300000,
1054
+ });
1055
+ // Additional SaaS-specific metrics
1056
+ export const SaaSMetrics = {
1057
+ mrr: 780000,
1058
+ arr: 9360000,
1059
+ customers: 720,
1060
+ arpu: 1083, // MRR / customers
1061
+ cac: 8500,
1062
+ ltv: 32500, // ARPU * 30 months avg
1063
+ ltvToCac: 3.8,
1064
+ paybackPeriod: 7.8, // months
1065
+ nrr: 115,
1066
+ grr: 97,
1067
+ quickRatio: 3.2, // (new + expansion) / (churn + contraction)
1068
+ burnMultiple: 1.8,
1069
+ ruleOf40: 52, // Growth rate + profit margin
1070
+ };
1071
+ // =============================================================================
1072
+ // 10. UTILITY FUNCTIONS
1073
+ // =============================================================================
1074
+ /**
1075
+ * Get full business summary
1076
+ */
1077
+ export function getBusinessSummary() {
1078
+ return {
1079
+ company: CloudMetricsBusiness,
1080
+ vision: CloudMetricsVision,
1081
+ goals: CloudMetricsGoals,
1082
+ product: CloudMetricsProduct,
1083
+ kpis: CloudMetricsKPIs,
1084
+ okrs: CloudMetricsOKRs,
1085
+ financials: CloudMetricsFinancials,
1086
+ metrics: SaaSMetrics,
1087
+ };
1088
+ }
1089
+ /**
1090
+ * Calculate runway based on current metrics
1091
+ */
1092
+ export function calculateRunway() {
1093
+ const monthlyBurn = (CloudMetricsFinancials.operatingExpenses - CloudMetricsFinancials.revenue) / 12;
1094
+ const cashOnHand = 5000000; // Assume $5M in bank
1095
+ return monthlyBurn > 0 ? cashOnHand / monthlyBurn : Infinity;
1096
+ }
1097
+ /**
1098
+ * Format key metrics for dashboard
1099
+ */
1100
+ export function getDashboardMetrics() {
1101
+ return {
1102
+ revenue: {
1103
+ mrr: $.format(SaaSMetrics.mrr),
1104
+ arr: $.format(SaaSMetrics.arr),
1105
+ growth: `${$.growth(SaaSMetrics.mrr, 700000)}%`, // vs last period
1106
+ },
1107
+ customers: {
1108
+ total: SaaSMetrics.customers,
1109
+ arpu: $.format(SaaSMetrics.arpu),
1110
+ nrr: `${SaaSMetrics.nrr}%`,
1111
+ },
1112
+ efficiency: {
1113
+ ltvToCac: `${SaaSMetrics.ltvToCac}x`,
1114
+ paybackPeriod: `${SaaSMetrics.paybackPeriod} months`,
1115
+ ruleOf40: SaaSMetrics.ruleOf40,
1116
+ },
1117
+ };
1118
+ }
1119
+ // Export everything
1120
+ export default {
1121
+ business: CloudMetricsBusiness,
1122
+ vision: CloudMetricsVision,
1123
+ goals: CloudMetricsGoals,
1124
+ product: CloudMetricsProduct,
1125
+ pricing: PricingTiers,
1126
+ organization: CloudMetricsOrg,
1127
+ kpis: CloudMetricsKPIs,
1128
+ okrs: CloudMetricsOKRs,
1129
+ processes: {
1130
+ leadToCustomer: LeadToCustomerProcess,
1131
+ onboarding: CustomerOnboardingProcess,
1132
+ support: SupportTicketProcess,
1133
+ },
1134
+ workflows: {
1135
+ leadScoring: LeadScoringWorkflow,
1136
+ churnPrediction: ChurnPredictionWorkflow,
1137
+ trialConversion: TrialConversionWorkflow,
1138
+ },
1139
+ financials: CloudMetricsFinancials,
1140
+ metrics: SaaSMetrics,
1141
+ };
1142
+ //# sourceMappingURL=index.js.map