@ak--47/dungeon-master 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +7 -7
  2. package/dungeons/technical/ad-spend-schema.json +128 -0
  3. package/dungeons/technical/ad-spend.js +116 -0
  4. package/dungeons/technical/anonymous-users-schema.json +91 -0
  5. package/dungeons/technical/anonymous-users.js +102 -0
  6. package/dungeons/technical/array-of-object-lookup-schema.json +191 -0
  7. package/dungeons/{array-of-object-lookup.js → technical/array-of-object-lookup.js} +11 -4
  8. package/dungeons/technical/experiments-schema.json +197 -0
  9. package/dungeons/technical/experiments.js +168 -0
  10. package/dungeons/technical/foobar-schema.json +362 -0
  11. package/dungeons/{foobar.js → technical/foobar.js} +2 -2
  12. package/dungeons/technical/group-analytics-schema.json +149 -0
  13. package/dungeons/technical/group-analytics.js +151 -0
  14. package/dungeons/technical/mirror-strategies-schema.json +84 -0
  15. package/dungeons/technical/mirror-strategies.js +126 -0
  16. package/dungeons/technical/nested-objects-schema.json +145 -0
  17. package/dungeons/technical/nested-objects.js +207 -0
  18. package/dungeons/technical/retention-cadence-schema.json +37 -0
  19. package/dungeons/{retention-cadence.js → technical/retention-cadence.js} +1 -1
  20. package/dungeons/technical/sanity-schema.json +185 -0
  21. package/dungeons/{sanity.js → technical/sanity.js} +3 -2
  22. package/dungeons/technical/scale-test-schema.json +70 -0
  23. package/dungeons/technical/scale-test.js +90 -0
  24. package/dungeons/technical/scd-schema.json +270 -0
  25. package/dungeons/{scd.js → technical/scd.js} +19 -10
  26. package/dungeons/technical/simple-schema.json +278 -0
  27. package/dungeons/{simple.js → technical/simple.js} +6 -6
  28. package/dungeons/technical/simplest-schema.json +635 -0
  29. package/dungeons/{simplest.js → technical/simplest.js} +6 -6
  30. package/dungeons/technical/text-generation-schema.json +1059 -0
  31. package/dungeons/{text-generation.js → technical/text-generation.js} +23 -9
  32. package/dungeons/vertical/community-schema.json +557 -0
  33. package/dungeons/vertical/community.js +788 -0
  34. package/dungeons/vertical/devtools-schema.json +580 -0
  35. package/dungeons/vertical/devtools.js +837 -0
  36. package/dungeons/vertical/ecommerce-schema.json +586 -0
  37. package/dungeons/{ecommerce.js → vertical/ecommerce.js} +34 -3
  38. package/dungeons/vertical/education-schema.json +697 -0
  39. package/dungeons/{education.js → vertical/education.js} +54 -36
  40. package/dungeons/vertical/fintech-schema.json +563 -0
  41. package/dungeons/{fintech.js → vertical/fintech.js} +91 -53
  42. package/dungeons/vertical/fitness-schema.json +508 -0
  43. package/dungeons/vertical/fitness.js +802 -0
  44. package/dungeons/vertical/food-delivery-schema.json +678 -0
  45. package/dungeons/{food.js → vertical/food-delivery.js} +51 -23
  46. package/dungeons/vertical/gaming-schema.json +394 -0
  47. package/dungeons/{gaming.js → vertical/gaming.js} +9 -7
  48. package/dungeons/vertical/healthcare-schema.json +527 -0
  49. package/dungeons/vertical/healthcare.js +769 -0
  50. package/dungeons/vertical/insurance-application-schema.json +466 -0
  51. package/dungeons/{insurance-application.js → vertical/insurance-application.js} +33 -29
  52. package/dungeons/vertical/logistics-schema.json +552 -0
  53. package/dungeons/vertical/logistics.js +793 -0
  54. package/dungeons/vertical/marketplace-schema.json +511 -0
  55. package/dungeons/vertical/marketplace.js +844 -0
  56. package/dungeons/vertical/media-schema.json +787 -0
  57. package/dungeons/{media.js → vertical/media.js} +94 -16
  58. package/dungeons/vertical/rpg-schema.json +654 -0
  59. package/dungeons/{rpg.js → vertical/rpg.js} +78 -57
  60. package/dungeons/vertical/sass-schema.json +653 -0
  61. package/dungeons/{sass.js → vertical/sass.js} +49 -23
  62. package/dungeons/vertical/social-schema.json +552 -0
  63. package/dungeons/{social.js → vertical/social.js} +60 -14
  64. package/dungeons/vertical/travel-schema.json +558 -0
  65. package/dungeons/vertical/travel.js +736 -0
  66. package/index.js +19 -15
  67. package/lib/core/config-validator.js +286 -1
  68. package/lib/core/context.js +7 -5
  69. package/lib/generators/adspend.js +3 -3
  70. package/lib/generators/events.js +141 -14
  71. package/lib/generators/funnels.js +67 -7
  72. package/lib/generators/text.js +2 -2
  73. package/lib/orchestrators/user-loop.js +441 -22
  74. package/lib/templates/soup-presets.js +2 -2
  75. package/lib/utils/utils.js +4 -5
  76. package/package.json +4 -3
  77. package/scripts/dungeon-to-json.mjs +163 -0
  78. package/scripts/extract-dungeon-schema.mjs +297 -0
  79. package/scripts/json-to-dungeon.mjs +200 -0
  80. package/scripts/run-dungeon.mjs +76 -0
  81. package/scripts/run-many.mjs +118 -0
  82. package/scripts/verify-runner.mjs +42 -0
  83. package/types.d.ts +313 -1
  84. package/dungeons/array-of-object-lookup-schema.json +0 -327
  85. package/dungeons/ecommerce-schema.json +0 -462
  86. package/dungeons/education-schema.json +0 -2409
  87. package/dungeons/fintech-schema.json +0 -14034
  88. package/dungeons/foobar-schema.json +0 -403
  89. package/dungeons/food-delivery-schema.json +0 -192
  90. package/dungeons/food-delivery.js +0 -602
  91. package/dungeons/food-schema.json +0 -1152
  92. package/dungeons/gaming-schema.json +0 -1270
  93. package/dungeons/insurance-application-schema.json +0 -204
  94. package/dungeons/media-schema.json +0 -906
  95. package/dungeons/retention-cadence-schema.json +0 -78
  96. package/dungeons/rpg-schema.json +0 -4526
  97. package/dungeons/sanity-schema.json +0 -255
  98. package/dungeons/sass-schema.json +0 -1291
  99. package/dungeons/scd-schema.json +0 -919
  100. package/dungeons/simple-schema.json +0 -608
  101. package/dungeons/simplest-schema.json +0 -1418
  102. package/dungeons/social-schema.json +0 -1118
  103. package/dungeons/text-generation-schema.json +0 -3096
@@ -1,7 +1,7 @@
1
1
  import dayjs from "dayjs";
2
2
  import utc from "dayjs/plugin/utc.js";
3
3
  import "dotenv/config";
4
- import * as u from "../lib/utils/utils.js";
4
+ import * as u from "../../lib/utils/utils.js";
5
5
  import * as v from "ak-tools";
6
6
 
7
7
  const SEED = "harness-sass";
@@ -345,10 +345,11 @@ const config = {
345
345
  event: "service deployed",
346
346
  weight: 10,
347
347
  properties: {
348
- service_id: u.pickAWinner(serviceIds),
348
+ service_id: serviceIds,
349
349
  service_type: ["web_app", "api", "database", "cache", "queue", "ml_model"],
350
350
  environment: ["production", "staging", "dev"],
351
351
  cloud_provider: ["aws", "gcp", "azure"],
352
+ docs_informed: [false],
352
353
  }
353
354
  },
354
355
  {
@@ -363,49 +364,66 @@ const config = {
363
364
  event: "alert triggered",
364
365
  weight: 12,
365
366
  properties: {
366
- alert_id: u.pickAWinner(alertIds),
367
+ alert_id: alertIds,
367
368
  severity: ["info", "warning", "critical", "emergency"],
368
369
  alert_type: ["cpu", "memory", "latency", "error_rate", "disk", "network"],
369
- service_id: u.pickAWinner(serviceIds),
370
+ service_id: serviceIds,
371
+ }
372
+ },
373
+ {
374
+ event: "incident created",
375
+ weight: 1,
376
+ properties: {
377
+ escalation_level: ["P1", "P2"],
378
+ teams_paged: u.weighNumRange(1, 5),
379
+ incident_id: () => `inc_${v.uid(8)}`,
380
+ original_severity: ["critical", "emergency"],
381
+ original_alert_type: ["cpu", "memory", "latency", "error_rate", "disk", "network"],
382
+ service_id: serviceIds,
383
+ auto_escalated: [true],
370
384
  }
371
385
  },
372
386
  {
373
387
  event: "alert acknowledged",
374
388
  weight: 8,
375
389
  properties: {
376
- alert_id: u.pickAWinner(alertIds),
390
+ alert_id: alertIds,
377
391
  response_time_mins: u.weighNumRange(1, 120),
378
392
  acknowledged_by_role: ["engineer", "sre", "manager", "oncall"],
393
+ integrated_team: [false],
379
394
  }
380
395
  },
381
396
  {
382
397
  event: "alert resolved",
383
398
  weight: 7,
384
399
  properties: {
385
- alert_id: u.pickAWinner(alertIds),
400
+ alert_id: alertIds,
386
401
  resolution_time_mins: u.weighNumRange(5, 1440),
387
402
  root_cause: ["config_change", "capacity", "bug", "dependency", "network"],
403
+ integrated_team: [false],
388
404
  }
389
405
  },
390
406
  {
391
407
  event: "deployment pipeline run",
392
408
  weight: 9,
393
409
  properties: {
394
- pipeline_id: u.pickAWinner(pipelineIds),
410
+ pipeline_id: pipelineIds,
395
411
  status: ["success", "failed", "cancelled"],
396
412
  duration_sec: u.weighNumRange(30, 1800),
397
413
  commit_count: u.weighNumRange(1, 20),
414
+ recovery_deployment: [false],
398
415
  }
399
416
  },
400
417
  {
401
418
  event: "infrastructure scaled",
402
419
  weight: 5,
403
420
  properties: {
404
- service_id: u.pickAWinner(serviceIds),
405
- scale_direction: u.pickAWinner(["up", "down"], 0.15),
421
+ service_id: serviceIds,
422
+ scale_direction: ["down", "down", "down", "down", "down", "down", "up"],
406
423
  previous_capacity: u.weighNumRange(1, 100),
407
424
  new_capacity: u.weighNumRange(1, 100),
408
- auto_scaled: u.pickAWinner([true, false], 0.15),
425
+ auto_scaled: [false, false, false, false, false, false, true],
426
+ cost_reaction: [false],
409
427
  }
410
428
  },
411
429
  {
@@ -415,6 +433,8 @@ const config = {
415
433
  report_period: ["daily", "weekly", "monthly"],
416
434
  total_cost: u.weighNumRange(100, 50000),
417
435
  cost_change_percent: u.weighNumRange(-30, 50),
436
+ cost_alert: [false],
437
+ budget_exceeded: [false],
418
438
  }
419
439
  },
420
440
  {
@@ -423,6 +443,8 @@ const config = {
423
443
  properties: {
424
444
  role: ["admin", "editor", "viewer", "billing"],
425
445
  invitation_method: ["email", "sso", "slack"],
446
+ quarter_end_push: [false],
447
+ duplicate_invite: [false],
426
448
  }
427
449
  },
428
450
  {
@@ -446,9 +468,9 @@ const config = {
446
468
  event: "runbook executed",
447
469
  weight: 3,
448
470
  properties: {
449
- runbook_id: u.pickAWinner(runbookIds),
471
+ runbook_id: runbookIds,
450
472
  trigger: ["manual", "automated", "alert_triggered"],
451
- success: u.pickAWinner([true, false], 0.15),
473
+ success: [false, false, false, false, false, false, true],
452
474
  }
453
475
  },
454
476
  {
@@ -457,6 +479,7 @@ const config = {
457
479
  properties: {
458
480
  event_type: ["invoice_generated", "payment_received", "payment_failed", "plan_upgraded", "plan_downgraded"],
459
481
  amount: u.weighNumRange(99, 25000),
482
+ quarter_end_push: [false],
460
483
  }
461
484
  },
462
485
  {
@@ -475,7 +498,7 @@ const config = {
475
498
  endpoint: ["/deploy", "/status", "/metrics", "/alerts", "/config", "/billing"],
476
499
  method: ["GET", "POST", "PUT", "DELETE"],
477
500
  response_time_ms: u.weighNumRange(10, 5000),
478
- status_code: u.pickAWinner([200, 201, 400, 401, 403, 500, 503]),
501
+ status_code: [200, 201, 400, 401, 403, 500, 503],
479
502
  }
480
503
  },
481
504
  {
@@ -491,21 +514,26 @@ const config = {
491
514
  weight: 4,
492
515
  properties: {
493
516
  flag_name: () => `flag_${chance.word()}`,
494
- new_state: u.pickAWinner(["enabled", "disabled"], 0.15),
517
+ new_state: ["disabled", "disabled", "disabled", "disabled", "disabled", "disabled", "enabled"],
495
518
  environment: ["production", "staging", "dev"],
496
519
  }
497
520
  },
498
521
  ],
499
522
 
500
523
  superProps: {
501
- plan_tier: u.pickAWinner(["free", "free", "team", "team", "business", "enterprise"]),
524
+ plan_tier: ["free", "free", "team", "team", "business", "enterprise"],
502
525
  cloud_provider: ["aws", "gcp", "azure", "multi_cloud"],
503
526
  },
504
527
 
505
528
  userProps: {
506
- company_size: u.pickAWinner(["startup", "startup", "smb", "mid_market", "enterprise"]),
529
+ company_size: ["startup", "startup", "smb", "mid_market", "enterprise"],
507
530
  primary_role: ["engineer", "sre", "devops", "manager", "executive"],
508
531
  team_name: ["Platform", "Backend", "Frontend", "Data", "Security", "Infrastructure"],
532
+ churned_account: [false],
533
+ seat_count: [1],
534
+ annual_contract_value: [0],
535
+ customer_success_manager: [false],
536
+ customer_health_score: u.weighNumRange(1, 100),
509
537
  },
510
538
 
511
539
  groupKeys: [
@@ -564,9 +592,8 @@ const config = {
564
592
  // 50% of the time duplicate the invite event (hiring push)
565
593
  if (chance.bool({ likelihood: 50 })) {
566
594
  return {
567
- event: "team member invited",
595
+ ...record,
568
596
  time: EVENT_TIME.add(chance.integer({ min: 1, max: 60 }), "minutes").toISOString(),
569
- user_id: record.user_id,
570
597
  role: chance.pickone(["editor", "viewer"]),
571
598
  invitation_method: chance.pickone(["email", "sso", "slack"]),
572
599
  quarter_end_push: true,
@@ -589,15 +616,13 @@ const config = {
589
616
  if ((severity === "critical" || severity === "emergency") && chance.bool({ likelihood: 30 })) {
590
617
  // REPLACE the event entirely with an "incident created" event
591
618
  return {
619
+ ...record,
592
620
  event: "incident created",
593
- time: record.time,
594
- user_id: record.user_id,
595
621
  escalation_level: chance.pickone(["P1", "P2"]),
596
622
  teams_paged: chance.integer({ min: 1, max: 5 }),
597
623
  incident_id: `inc_${v.uid(8)}`,
598
624
  original_severity: severity,
599
625
  original_alert_type: record.alert_type,
600
- service_id: record.service_id,
601
626
  auto_escalated: true,
602
627
  };
603
628
  }
@@ -738,10 +763,11 @@ const config = {
738
763
  if (bestPracticesCount >= 3) {
739
764
  const extraDeploys = chance.integer({ min: 2, max: 3 });
740
765
  const lastEvent = userEvents[userEvents.length - 1];
741
- if (lastEvent) {
766
+ const deployTemplate = userEvents.find(e => e.event === "service deployed");
767
+ if (lastEvent && deployTemplate) {
742
768
  for (let i = 0; i < extraDeploys; i++) {
743
769
  const deployEvent = {
744
- event: "service deployed",
770
+ ...deployTemplate,
745
771
  time: dayjs(lastEvent.time).add(chance.integer({ min: 1, max: 48 }), "hours").toISOString(),
746
772
  user_id: lastEvent.user_id,
747
773
  service_id: chance.pickone(serviceIds),