@wraps.dev/cli 1.5.0 → 1.5.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.
package/dist/cli.js CHANGED
@@ -146,7 +146,7 @@ var require_package = __commonJS({
146
146
  "package.json"(exports, module) {
147
147
  module.exports = {
148
148
  name: "@wraps.dev/cli",
149
- version: "1.5.0",
149
+ version: "1.5.1",
150
150
  description: "CLI for deploying Wraps email infrastructure to your AWS account",
151
151
  type: "module",
152
152
  main: "./dist/cli.js",
@@ -448,6 +448,21 @@ function trackCommand(command, metadata) {
448
448
  sanitized.email = void 0;
449
449
  client.track(`command:${command}`, sanitized);
450
450
  }
451
+ function trackServiceInit(service, success, metadata) {
452
+ const client = getTelemetryClient();
453
+ client.track("service:init", {
454
+ service,
455
+ success,
456
+ ...metadata
457
+ });
458
+ }
459
+ function trackServiceDeployed(service, metadata) {
460
+ const client = getTelemetryClient();
461
+ client.track("service:deployed", {
462
+ service,
463
+ ...metadata
464
+ });
465
+ }
451
466
  function trackError(errorCode, command, metadata) {
452
467
  const client = getTelemetryClient();
453
468
  client.track("error:occurred", {
@@ -456,6 +471,24 @@ function trackError(errorCode, command, metadata) {
456
471
  ...metadata
457
472
  });
458
473
  }
474
+ function trackFeature(feature, metadata) {
475
+ const client = getTelemetryClient();
476
+ client.track(`feature:${feature}`, metadata || {});
477
+ }
478
+ function trackServiceUpgrade(service, metadata) {
479
+ const client = getTelemetryClient();
480
+ client.track("service:upgraded", {
481
+ service,
482
+ ...metadata
483
+ });
484
+ }
485
+ function trackServiceRemoved(service, metadata) {
486
+ const client = getTelemetryClient();
487
+ client.track("service:removed", {
488
+ service,
489
+ ...metadata
490
+ });
491
+ }
459
492
  var init_events = __esm({
460
493
  "src/telemetry/events.ts"() {
461
494
  "use strict";
@@ -4384,6 +4417,7 @@ async function deployEmailStack(config2) {
4384
4417
  }
4385
4418
 
4386
4419
  // src/commands/email/config.ts
4420
+ init_events();
4387
4421
  init_aws();
4388
4422
  init_errors();
4389
4423
 
@@ -4418,6 +4452,7 @@ async function ensurePulumiInstalled() {
4418
4452
 
4419
4453
  // src/commands/email/config.ts
4420
4454
  async function config(options) {
4455
+ const startTime = Date.now();
4421
4456
  clack3.intro(
4422
4457
  pc4.bold(
4423
4458
  options.preview ? "Wraps Config Preview" : "Wraps Config - Apply CLI Updates to Infrastructure"
@@ -4566,8 +4601,14 @@ ${pc4.bold("Current Configuration:")}
4566
4601
  clack3.outro(
4567
4602
  pc4.green("Preview complete. Run without --preview to update.")
4568
4603
  );
4604
+ trackCommand("email:config", {
4605
+ success: true,
4606
+ preview: true,
4607
+ duration_ms: Date.now() - startTime
4608
+ });
4569
4609
  return;
4570
4610
  } catch (error) {
4611
+ trackError("PREVIEW_FAILED", "email:config", { step: "preview" });
4571
4612
  if (error.message?.includes("stack is currently locked")) {
4572
4613
  throw errors.stackLocked();
4573
4614
  }
@@ -4629,9 +4670,15 @@ ${pc4.bold("Current Configuration:")}
4629
4670
  }
4630
4671
  );
4631
4672
  } catch (error) {
4673
+ trackCommand("email:config", {
4674
+ success: false,
4675
+ duration_ms: Date.now() - startTime
4676
+ });
4632
4677
  if (error.message?.includes("stack is currently locked")) {
4678
+ trackError("STACK_LOCKED", "email:config", { step: "update" });
4633
4679
  throw errors.stackLocked();
4634
4680
  }
4681
+ trackError("UPDATE_FAILED", "email:config", { step: "update" });
4635
4682
  throw new Error(`Pulumi update failed: ${error.message}`);
4636
4683
  }
4637
4684
  metadata.timestamp = (/* @__PURE__ */ new Date()).toISOString();
@@ -4662,6 +4709,10 @@ ${pc4.green("\u2713")} ${pc4.bold("Update complete!")}
4662
4709
  ` ${pc4.cyan("3.")} View analytics at ${pc4.cyan("wraps console")}
4663
4710
  `
4664
4711
  );
4712
+ trackCommand("email:config", {
4713
+ success: true,
4714
+ duration_ms: Date.now() - startTime
4715
+ });
4665
4716
  }
4666
4717
 
4667
4718
  // src/commands/email/connect.ts
@@ -4669,6 +4720,7 @@ init_esm_shims();
4669
4720
  import * as clack5 from "@clack/prompts";
4670
4721
  import * as pulumi6 from "@pulumi/pulumi";
4671
4722
  import pc6 from "picocolors";
4723
+ init_events();
4672
4724
  init_presets();
4673
4725
  init_aws();
4674
4726
  init_errors();
@@ -4902,6 +4954,7 @@ async function scanAWSResources(region) {
4902
4954
 
4903
4955
  // src/commands/email/connect.ts
4904
4956
  async function connect(options) {
4957
+ const startTime = Date.now();
4905
4958
  clack5.intro(
4906
4959
  pc6.bold(
4907
4960
  options.preview ? "Wraps Connect Preview" : "Wraps Connect - Link Existing Infrastructure"
@@ -5042,8 +5095,16 @@ async function connect(options) {
5042
5095
  clack5.outro(
5043
5096
  pc6.green("Preview complete. Run without --preview to connect.")
5044
5097
  );
5098
+ trackServiceInit("email", true, {
5099
+ preset,
5100
+ provider,
5101
+ preview: true,
5102
+ duration_ms: Date.now() - startTime,
5103
+ existing_identities: selectedIdentities.length
5104
+ });
5045
5105
  return;
5046
5106
  } catch (error) {
5107
+ trackError("PREVIEW_FAILED", "email:connect", { step: "preview" });
5047
5108
  if (error.message?.includes("stack is currently locked")) {
5048
5109
  throw errors.stackLocked();
5049
5110
  }
@@ -5103,9 +5164,16 @@ async function connect(options) {
5103
5164
  }
5104
5165
  );
5105
5166
  } catch (error) {
5167
+ trackServiceInit("email", false, {
5168
+ preset,
5169
+ provider,
5170
+ duration_ms: Date.now() - startTime
5171
+ });
5106
5172
  if (error.message?.includes("stack is currently locked")) {
5173
+ trackError("STACK_LOCKED", "email:connect", { step: "deploy" });
5107
5174
  throw errors.stackLocked();
5108
5175
  }
5176
+ trackError("DEPLOYMENT_FAILED", "email:connect", { step: "deploy" });
5109
5177
  throw new Error(`Pulumi deployment failed: ${error.message}`);
5110
5178
  }
5111
5179
  if (outputs.domain && outputs.dkimTokens && outputs.dkimTokens.length > 0) {
@@ -5172,10 +5240,32 @@ ${pc6.dim("Example:")}`);
5172
5240
  );
5173
5241
  console.log("");
5174
5242
  }
5243
+ const duration = Date.now() - startTime;
5244
+ const enabledFeatures = [];
5245
+ if (emailConfig.tracking?.enabled) enabledFeatures.push("tracking");
5246
+ if (emailConfig.suppressionList?.enabled)
5247
+ enabledFeatures.push("suppression_list");
5248
+ if (emailConfig.eventTracking?.enabled)
5249
+ enabledFeatures.push("event_tracking");
5250
+ if (emailConfig.eventTracking?.dynamoDBHistory)
5251
+ enabledFeatures.push("dynamodb_history");
5252
+ trackServiceInit("email", true, {
5253
+ preset,
5254
+ provider,
5255
+ features: enabledFeatures,
5256
+ duration_ms: duration,
5257
+ existing_identities: selectedIdentities.length
5258
+ });
5259
+ trackServiceDeployed("email", {
5260
+ duration_ms: duration,
5261
+ features: enabledFeatures,
5262
+ preset
5263
+ });
5175
5264
  }
5176
5265
 
5177
5266
  // src/commands/email/domains.ts
5178
5267
  init_esm_shims();
5268
+ init_events();
5179
5269
  init_aws();
5180
5270
  import { Resolver } from "dns/promises";
5181
5271
  import { GetEmailIdentityCommand, SESv2Client as SESv2Client2 } from "@aws-sdk/client-sesv2";
@@ -5347,6 +5437,7 @@ Run ${pc7.cyan(`wraps email init --domain ${options.domain}`)} to add this domai
5347
5437
  clack6.outro(
5348
5438
  pc7.green("\u2713 Domain is fully verified and ready to send emails!")
5349
5439
  );
5440
+ trackFeature("domain_verified", { dns_auto_detected: true });
5350
5441
  } else if (someIncorrect) {
5351
5442
  clack6.outro(
5352
5443
  pc7.red("\u2717 Some DNS records are incorrect. Please update them.")
@@ -5365,6 +5456,11 @@ Run ${pc7.cyan("wraps email status")} to see the correct DNS records.
5365
5456
  "SES verification usually completes within 72 hours after DNS propagation.\n"
5366
5457
  );
5367
5458
  }
5459
+ trackCommand("email:domains:verify", {
5460
+ success: true,
5461
+ verified: verificationStatus === "verified" && allVerified,
5462
+ dkim_status: dkimStatus
5463
+ });
5368
5464
  }
5369
5465
  async function addDomain(options) {
5370
5466
  clack6.intro(pc7.bold(`Adding domain ${options.domain} to SES`));
@@ -5422,8 +5518,15 @@ ${pc7.bold("Next steps:")}
5422
5518
  );
5423
5519
  console.log(`3. Check status: ${pc7.cyan("wraps email status")}
5424
5520
  `);
5521
+ trackCommand("email:domains:add", {
5522
+ success: true
5523
+ });
5524
+ trackFeature("domain_added", {});
5425
5525
  } catch (error) {
5426
5526
  progress.stop();
5527
+ trackCommand("email:domains:add", {
5528
+ success: false
5529
+ });
5427
5530
  throw error;
5428
5531
  }
5429
5532
  }
@@ -5492,8 +5595,13 @@ Run ${pc7.cyan("wraps email domains add <domain>")} to add a domain.
5492
5595
  `Run ${pc7.cyan("wraps email domains verify --domain <domain>")} for details`
5493
5596
  )
5494
5597
  );
5598
+ trackCommand("email:domains:list", {
5599
+ success: true,
5600
+ domain_count: domains.length
5601
+ });
5495
5602
  } catch (error) {
5496
5603
  progress.stop();
5604
+ trackCommand("email:domains:list", { success: false });
5497
5605
  throw error;
5498
5606
  }
5499
5607
  }
@@ -5536,8 +5644,13 @@ ${pc7.bold("DNS Records to add:")}
5536
5644
  `
5537
5645
  );
5538
5646
  }
5647
+ trackCommand("email:domains:get-dkim", {
5648
+ success: true,
5649
+ dkim_status: dkimStatus
5650
+ });
5539
5651
  } catch (error) {
5540
5652
  progress.stop();
5653
+ trackCommand("email:domains:get-dkim", { success: false });
5541
5654
  if (error.name === "NotFoundException") {
5542
5655
  clack6.log.error(`Domain ${options.domain} not found in SES`);
5543
5656
  console.log(
@@ -5583,8 +5696,13 @@ async function removeDomain(options) {
5583
5696
  });
5584
5697
  progress.stop();
5585
5698
  clack6.outro(pc7.green(`\u2713 Domain ${options.domain} removed successfully`));
5699
+ trackCommand("email:domains:remove", {
5700
+ success: true
5701
+ });
5702
+ trackFeature("domain_removed", {});
5586
5703
  } catch (error) {
5587
5704
  progress.stop();
5705
+ trackCommand("email:domains:remove", { success: false });
5588
5706
  if (error.name === "NotFoundException") {
5589
5707
  clack6.log.error(`Domain ${options.domain} not found in SES`);
5590
5708
  process.exit(1);
@@ -5599,12 +5717,14 @@ init_esm_shims();
5599
5717
  import * as clack7 from "@clack/prompts";
5600
5718
  import * as pulumi7 from "@pulumi/pulumi";
5601
5719
  import pc8 from "picocolors";
5720
+ init_events();
5602
5721
  init_costs();
5603
5722
  init_presets();
5604
5723
  init_aws();
5605
5724
  init_errors();
5606
5725
  init_prompts();
5607
5726
  async function init(options) {
5727
+ const startTime = Date.now();
5608
5728
  clack7.intro(
5609
5729
  pc8.bold(
5610
5730
  options.preview ? "Wraps Email Infrastructure Preview" : "Wraps Email Infrastructure Setup"
@@ -5755,8 +5875,15 @@ ${pc8.yellow(pc8.bold("Configuration Warnings:"))}`);
5755
5875
  clack7.outro(
5756
5876
  pc8.green("Preview complete. Run without --preview to deploy.")
5757
5877
  );
5878
+ trackServiceInit("email", true, {
5879
+ preset,
5880
+ provider,
5881
+ preview: true,
5882
+ duration_ms: Date.now() - startTime
5883
+ });
5758
5884
  return;
5759
5885
  } catch (error) {
5886
+ trackError("PREVIEW_FAILED", "email:init", { step: "preview" });
5760
5887
  if (error.message?.includes("stack is currently locked")) {
5761
5888
  throw errors.stackLocked();
5762
5889
  }
@@ -5826,9 +5953,16 @@ ${pc8.yellow(pc8.bold("Configuration Warnings:"))}`);
5826
5953
  }
5827
5954
  );
5828
5955
  } catch (error) {
5956
+ trackServiceInit("email", false, {
5957
+ preset,
5958
+ provider,
5959
+ duration_ms: Date.now() - startTime
5960
+ });
5829
5961
  if (error.message?.includes("stack is currently locked")) {
5962
+ trackError("STACK_LOCKED", "email:init", { step: "deploy" });
5830
5963
  throw errors.stackLocked();
5831
5964
  }
5965
+ trackError("DEPLOYMENT_FAILED", "email:init", { step: "deploy" });
5832
5966
  throw new Error(`Pulumi deployment failed: ${error.message}`);
5833
5967
  }
5834
5968
  if (metadata.services.email) {
@@ -5879,15 +6013,40 @@ ${pc8.yellow(pc8.bold("Configuration Warnings:"))}`);
5879
6013
  domain: outputs.domain,
5880
6014
  mailFromDomain: outputs.mailFromDomain
5881
6015
  });
6016
+ const duration = Date.now() - startTime;
6017
+ const enabledFeatures = [];
6018
+ if (emailConfig.tracking?.enabled) enabledFeatures.push("tracking");
6019
+ if (emailConfig.suppressionList?.enabled)
6020
+ enabledFeatures.push("suppression_list");
6021
+ if (emailConfig.eventTracking?.enabled)
6022
+ enabledFeatures.push("event_tracking");
6023
+ if (emailConfig.eventTracking?.dynamoDBHistory)
6024
+ enabledFeatures.push("dynamodb_history");
6025
+ if (emailConfig.dedicatedIp) enabledFeatures.push("dedicated_ip");
6026
+ if (emailConfig.emailArchiving?.enabled)
6027
+ enabledFeatures.push("email_archiving");
6028
+ trackServiceInit("email", true, {
6029
+ preset,
6030
+ provider,
6031
+ features: enabledFeatures,
6032
+ duration_ms: duration
6033
+ });
6034
+ trackServiceDeployed("email", {
6035
+ duration_ms: duration,
6036
+ features: enabledFeatures,
6037
+ preset
6038
+ });
5882
6039
  }
5883
6040
 
5884
6041
  // src/commands/email/restore.ts
5885
6042
  init_esm_shims();
6043
+ init_events();
5886
6044
  init_aws();
5887
6045
  import * as clack8 from "@clack/prompts";
5888
6046
  import * as pulumi8 from "@pulumi/pulumi";
5889
6047
  import pc9 from "picocolors";
5890
6048
  async function restore(options) {
6049
+ const startTime = Date.now();
5891
6050
  clack8.intro(
5892
6051
  pc9.bold(
5893
6052
  options.preview ? "Wraps Restore Preview" : "Wraps Restore - Remove Wraps Infrastructure"
@@ -5986,8 +6145,13 @@ ${pc9.bold("The following Wraps resources will be removed:")}
5986
6145
  "Preview complete. Run without --preview to remove infrastructure."
5987
6146
  )
5988
6147
  );
6148
+ trackServiceRemoved("email", {
6149
+ preview: true,
6150
+ duration_ms: Date.now() - startTime
6151
+ });
5989
6152
  return;
5990
6153
  } catch (error) {
6154
+ trackError("PREVIEW_FAILED", "email:restore", { step: "preview" });
5991
6155
  throw new Error(`Preview failed: ${error.message}`);
5992
6156
  }
5993
6157
  }
@@ -6022,6 +6186,7 @@ ${pc9.bold("The following Wraps resources will be removed:")}
6022
6186
  metadata.services.email.pulumiStackName
6023
6187
  );
6024
6188
  } catch (error) {
6189
+ trackError("DESTROY_FAILED", "email:restore", { step: "destroy" });
6025
6190
  throw new Error(`Failed to destroy Pulumi stack: ${error.message}`);
6026
6191
  }
6027
6192
  });
@@ -6038,6 +6203,10 @@ ${pc9.green("\u2713")} ${pc9.bold("Infrastructure removed successfully!")}
6038
6203
  );
6039
6204
  console.log(`${pc9.dim("Your original AWS resources remain unchanged.")}
6040
6205
  `);
6206
+ trackServiceRemoved("email", {
6207
+ reason: "user_initiated",
6208
+ duration_ms: Date.now() - startTime
6209
+ });
6041
6210
  }
6042
6211
 
6043
6212
  // src/commands/email/upgrade.ts
@@ -6045,12 +6214,15 @@ init_esm_shims();
6045
6214
  import * as clack9 from "@clack/prompts";
6046
6215
  import * as pulumi9 from "@pulumi/pulumi";
6047
6216
  import pc10 from "picocolors";
6217
+ init_events();
6048
6218
  init_costs();
6049
6219
  init_presets();
6050
6220
  init_aws();
6051
6221
  init_errors();
6052
6222
  init_prompts();
6053
6223
  async function upgrade(options) {
6224
+ const startTime = Date.now();
6225
+ let upgradeAction = "";
6054
6226
  clack9.intro(
6055
6227
  pc10.bold(
6056
6228
  options.preview ? "Wraps Upgrade Preview" : "Wraps Upgrade - Enhance Your Email Infrastructure"
@@ -6157,7 +6329,7 @@ ${pc10.bold("Current Configuration:")}
6157
6329
  Estimated Cost: ${pc10.cyan(`~${formatCost(currentCostData.total.monthly)}/mo`)}`
6158
6330
  );
6159
6331
  console.log("");
6160
- const upgradeAction = await clack9.select({
6332
+ upgradeAction = await clack9.select({
6161
6333
  message: "What would you like to do?",
6162
6334
  options: [
6163
6335
  {
@@ -6766,8 +6938,16 @@ ${pc10.bold("Cost Impact:")}`);
6766
6938
  clack9.outro(
6767
6939
  pc10.green("Preview complete. Run without --preview to upgrade.")
6768
6940
  );
6941
+ trackServiceUpgrade("email", {
6942
+ from_preset: metadata.services.email?.preset,
6943
+ to_preset: newPreset,
6944
+ preview: true,
6945
+ action: typeof upgradeAction === "string" ? upgradeAction : void 0,
6946
+ duration_ms: Date.now() - startTime
6947
+ });
6769
6948
  return;
6770
6949
  } catch (error) {
6950
+ trackError("PREVIEW_FAILED", "email:upgrade", { step: "preview" });
6771
6951
  if (error.message?.includes("stack is currently locked")) {
6772
6952
  throw errors.stackLocked();
6773
6953
  }
@@ -6841,9 +7021,17 @@ ${pc10.bold("Cost Impact:")}`);
6841
7021
  }
6842
7022
  );
6843
7023
  } catch (error) {
7024
+ trackServiceUpgrade("email", {
7025
+ from_preset: metadata.services.email?.preset,
7026
+ to_preset: newPreset,
7027
+ action: typeof upgradeAction === "string" ? upgradeAction : void 0,
7028
+ duration_ms: Date.now() - startTime
7029
+ });
6844
7030
  if (error.message?.includes("stack is currently locked")) {
7031
+ trackError("STACK_LOCKED", "email:upgrade", { step: "deploy" });
6845
7032
  throw errors.stackLocked();
6846
7033
  }
7034
+ trackError("UPGRADE_FAILED", "email:upgrade", { step: "deploy" });
6847
7035
  throw new Error(`Pulumi upgrade failed: ${error.message}`);
6848
7036
  }
6849
7037
  if (outputs.domain && outputs.dkimTokens && outputs.dkimTokens.length > 0) {
@@ -6948,6 +7136,24 @@ ${pc10.green("\u2713")} ${pc10.bold("Upgrade complete!")}
6948
7136
  pc10.green("\u2713") + " " + pc10.bold("HTTPS tracking is fully configured and ready to use!\n")
6949
7137
  );
6950
7138
  }
7139
+ const enabledFeatures = [];
7140
+ if (updatedConfig.tracking?.enabled) enabledFeatures.push("tracking");
7141
+ if (updatedConfig.suppressionList?.enabled)
7142
+ enabledFeatures.push("suppression_list");
7143
+ if (updatedConfig.eventTracking?.enabled)
7144
+ enabledFeatures.push("event_tracking");
7145
+ if (updatedConfig.eventTracking?.dynamoDBHistory)
7146
+ enabledFeatures.push("dynamodb_history");
7147
+ if (updatedConfig.dedicatedIp) enabledFeatures.push("dedicated_ip");
7148
+ if (updatedConfig.emailArchiving?.enabled)
7149
+ enabledFeatures.push("email_archiving");
7150
+ trackServiceUpgrade("email", {
7151
+ from_preset: metadata.services.email?.preset,
7152
+ to_preset: newPreset,
7153
+ added_features: enabledFeatures,
7154
+ action: typeof upgradeAction === "string" ? upgradeAction : void 0,
7155
+ duration_ms: Date.now() - startTime
7156
+ });
6951
7157
  }
6952
7158
 
6953
7159
  // src/commands/shared/dashboard.ts
@@ -8178,6 +8384,7 @@ async function startConsoleServer(config2) {
8178
8384
  }
8179
8385
 
8180
8386
  // src/commands/shared/dashboard.ts
8387
+ init_events();
8181
8388
  init_aws();
8182
8389
  async function dashboard(options) {
8183
8390
  clack10.intro(pc11.bold("Wraps Dashboard"));
@@ -8228,17 +8435,24 @@ async function dashboard(options) {
8228
8435
  if (!options.noOpen) {
8229
8436
  await open(url);
8230
8437
  }
8438
+ trackCommand("console", {
8439
+ success: true,
8440
+ port,
8441
+ no_open: options.noOpen ?? false
8442
+ });
8231
8443
  await new Promise(() => {
8232
8444
  });
8233
8445
  }
8234
8446
 
8235
8447
  // src/commands/shared/destroy.ts
8236
8448
  init_esm_shims();
8449
+ init_events();
8237
8450
  init_aws();
8238
8451
  import * as clack11 from "@clack/prompts";
8239
8452
  import * as pulumi11 from "@pulumi/pulumi";
8240
8453
  import pc12 from "picocolors";
8241
8454
  async function destroy(options) {
8455
+ const startTime = Date.now();
8242
8456
  clack11.intro(
8243
8457
  pc12.bold(
8244
8458
  options.preview ? "Wraps Destruction Preview" : "Wraps Email Infrastructure Teardown"
@@ -8290,6 +8504,10 @@ async function destroy(options) {
8290
8504
  clack11.outro(
8291
8505
  pc12.green("Preview complete. Run without --preview to destroy.")
8292
8506
  );
8507
+ trackServiceRemoved("email", {
8508
+ preview: true,
8509
+ duration_ms: Date.now() - startTime
8510
+ });
8293
8511
  return;
8294
8512
  } catch (error) {
8295
8513
  progress.stop();
@@ -8297,6 +8515,7 @@ async function destroy(options) {
8297
8515
  clack11.log.warn("No Wraps infrastructure found to preview");
8298
8516
  process.exit(0);
8299
8517
  }
8518
+ trackError("PREVIEW_FAILED", "destroy", { step: "preview" });
8300
8519
  throw new Error(`Preview failed: ${error.message}`);
8301
8520
  }
8302
8521
  }
@@ -8327,6 +8546,7 @@ async function destroy(options) {
8327
8546
  await deleteConnectionMetadata(identity.accountId, region);
8328
8547
  process.exit(0);
8329
8548
  }
8549
+ trackError("DESTROY_FAILED", "destroy", { step: "destroy" });
8330
8550
  clack11.log.error("Infrastructure destruction failed");
8331
8551
  throw error;
8332
8552
  }
@@ -8338,15 +8558,21 @@ async function destroy(options) {
8338
8558
  Run ${pc12.cyan("wraps email init")} to deploy infrastructure again.
8339
8559
  `
8340
8560
  );
8561
+ trackServiceRemoved("email", {
8562
+ reason: "user_initiated",
8563
+ duration_ms: Date.now() - startTime
8564
+ });
8341
8565
  }
8342
8566
 
8343
8567
  // src/commands/shared/status.ts
8344
8568
  init_esm_shims();
8569
+ init_events();
8345
8570
  init_aws();
8346
8571
  import * as clack12 from "@clack/prompts";
8347
8572
  import * as pulumi12 from "@pulumi/pulumi";
8348
8573
  import pc13 from "picocolors";
8349
8574
  async function status(_options) {
8575
+ const startTime = Date.now();
8350
8576
  const progress = new DeploymentProgress();
8351
8577
  const identity = await progress.execute(
8352
8578
  "Loading infrastructure status",
@@ -8420,6 +8646,12 @@ Run ${pc13.cyan("wraps email init")} to deploy infrastructure.
8420
8646
  cloudFrontDomain: stackOutputs.cloudFrontDomain?.value
8421
8647
  } : void 0
8422
8648
  });
8649
+ trackCommand("status", {
8650
+ success: true,
8651
+ domain_count: domainsWithTokens.length,
8652
+ integration_level: integrationLevel,
8653
+ duration_ms: Date.now() - startTime
8654
+ });
8423
8655
  }
8424
8656
 
8425
8657
  // src/commands/telemetry.ts
@@ -8861,6 +9093,13 @@ Run ${pc15.cyan("wraps --help")} for available commands.
8861
9093
  );
8862
9094
  process.exit(1);
8863
9095
  }
9096
+ const emailDuration = Date.now() - startTime;
9097
+ const emailCommandName = `email:${subCommand}`;
9098
+ trackCommand(emailCommandName, {
9099
+ success: true,
9100
+ duration_ms: emailDuration,
9101
+ service: "email"
9102
+ });
8864
9103
  return;
8865
9104
  }
8866
9105
  if (primaryCommand === "dashboard" && subCommand) {
@@ -8880,6 +9119,12 @@ Available commands: ${pc15.cyan("update-role")}
8880
9119
  `);
8881
9120
  process.exit(1);
8882
9121
  }
9122
+ const dashboardDuration = Date.now() - startTime;
9123
+ const dashboardCommandName = `dashboard:${subCommand}`;
9124
+ trackCommand(dashboardCommandName, {
9125
+ success: true,
9126
+ duration_ms: dashboardDuration
9127
+ });
8883
9128
  return;
8884
9129
  }
8885
9130
  if (primaryCommand === "sms" && subCommand) {