@dosu/cli 0.52.1 → 0.52.2

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 (2) hide show
  1. package/bin/dosu.js +31 -20
  2. package/package.json +1 -1
package/bin/dosu.js CHANGED
@@ -5000,7 +5000,7 @@ function isNpxInvocation(channel = INSTALL_CHANNEL, env = process.env) {
5000
5000
  function getVersionString() {
5001
5001
  return `v${VERSION}`;
5002
5002
  }
5003
- var VERSION = "0.52.1", INSTALL_CHANNEL = "npm";
5003
+ var VERSION = "0.52.2", INSTALL_CHANNEL = "npm";
5004
5004
 
5005
5005
  // src/debug/logger.ts
5006
5006
  import {
@@ -5134,7 +5134,7 @@ var init_logger = __esm(() => {
5134
5134
  });
5135
5135
 
5136
5136
  // src/client/contract.ts
5137
- var CLI_CONTRACT_HASH = "85b07f7689e2";
5137
+ var CLI_CONTRACT_HASH = "1d4be4b6214f";
5138
5138
 
5139
5139
  // src/client/trpc.ts
5140
5140
  var exports_trpc = {};
@@ -11444,7 +11444,7 @@ var init_settings = __esm(() => {
11444
11444
  });
11445
11445
 
11446
11446
  // src/telemetry/debug-id.ts
11447
- var BUNDLE_DEBUG_ID_PLACEHOLDER = "61606b23-6c2b-78a9-6475-6e2164756e21";
11447
+ var BUNDLE_DEBUG_ID_PLACEHOLDER = "11869608-d7a8-aa45-6475-6e2164756e21";
11448
11448
 
11449
11449
  // src/telemetry/telemetry.ts
11450
11450
  import { randomUUID as randomUUID3 } from "node:crypto";
@@ -11473,11 +11473,13 @@ function normalizeContext(context) {
11473
11473
  const isAuthenticated2 = context?.isAuthenticated === true;
11474
11474
  const id = safeRead(context?.user, "id");
11475
11475
  const email = safeRead(context?.user, "email");
11476
- const user = isAuthenticated2 && validUserId(id) ? { id, ...validEmail(email) ? { email } : {} } : undefined;
11476
+ const orgId = safeRead(context, "orgId");
11477
+ const user = isAuthenticated2 && isUUID2(id) ? { id, ...validEmail(email) ? { email } : {} } : undefined;
11477
11478
  return {
11478
11479
  mode: context?.mode === "oss" ? "oss" : "cloud",
11479
11480
  isAuthenticated: isAuthenticated2,
11480
- ...user ? { user } : {}
11481
+ ...user ? { user } : {},
11482
+ ...user && isUUID2(orgId) ? { orgId } : {}
11481
11483
  };
11482
11484
  }
11483
11485
  function normalizeExitCode(value, fallback = 1) {
@@ -11497,12 +11499,9 @@ function normalizeRuntime(runtime) {
11497
11499
  isTty: runtime.isTty === true
11498
11500
  };
11499
11501
  }
11500
- function validInstallId(value) {
11502
+ function isUUID2(value) {
11501
11503
  return typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
11502
11504
  }
11503
- function validUserId(value) {
11504
- return validInstallId(value);
11505
- }
11506
11505
  function validEmail(value) {
11507
11506
  return typeof value === "string" && value.length <= 254 && /^[A-Za-z0-9.!#$%&'*+/=?^_`{|}~-]+@[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)+$/.test(value);
11508
11507
  }
@@ -11652,7 +11651,7 @@ function buildPostHogPayload(input) {
11652
11651
  const result = input.result === "success" || input.result === "validation_error" ? input.result : "failure";
11653
11652
  return {
11654
11653
  api_key: input.apiKey,
11655
- distinct_id: context.user?.id ?? (validInstallId(input.installId) ? input.installId : FALLBACK_INSTALL_ID),
11654
+ distinct_id: context.user?.id ?? (isUUID2(input.installId) ? input.installId : FALLBACK_INSTALL_ID),
11656
11655
  event: "cli_command_completed",
11657
11656
  properties: {
11658
11657
  $geoip_disable: true,
@@ -11670,6 +11669,10 @@ function buildPostHogPayload(input) {
11670
11669
  is_ci: runtime.isCi,
11671
11670
  is_tty: runtime.isTty,
11672
11671
  mode: context.mode,
11672
+ ...context.orgId ? {
11673
+ org_id: context.orgId,
11674
+ $groups: { organization: context.orgId }
11675
+ } : {},
11673
11676
  is_authenticated: context.isAuthenticated,
11674
11677
  exit_code: normalizeExitCode(input.exitCode),
11675
11678
  ...errorCode ? { error_code: errorCode } : {}
@@ -11784,7 +11787,12 @@ function buildSentryEnvelope(input) {
11784
11787
  level: "error",
11785
11788
  release: `dosu-cli@${runtime.version}`,
11786
11789
  tags: sentryTags(command, context, runtime, error),
11787
- ...context.user ? { user: context.user } : {},
11790
+ ...context.user ? {
11791
+ user: {
11792
+ id: context.user.id,
11793
+ ...context.user.email ? { email: context.user.email } : {}
11794
+ }
11795
+ } : {},
11788
11796
  ...mappedBundle ? {
11789
11797
  debug_meta: {
11790
11798
  images: [{ type: "sourcemap", code_file: BUNDLE_CODE_FILE, debug_id: debugId }]
@@ -11978,7 +11986,7 @@ function safeNow(now) {
11978
11986
  function safeUuid(generate) {
11979
11987
  try {
11980
11988
  const value = generate();
11981
- return validInstallId(value) ? value : undefined;
11989
+ return isUUID2(value) ? value : undefined;
11982
11990
  } catch {
11983
11991
  return;
11984
11992
  }
@@ -12010,7 +12018,7 @@ function createCommandTelemetry(settings2, dependencies = {}) {
12010
12018
  let installIdResolved = false;
12011
12019
  let resolvedInstallId = settings2.install_id;
12012
12020
  function installId() {
12013
- if (validInstallId(resolvedInstallId))
12021
+ if (isUUID2(resolvedInstallId))
12014
12022
  return resolvedInstallId;
12015
12023
  if (installIdResolved)
12016
12024
  return;
@@ -12020,7 +12028,7 @@ function createCommandTelemetry(settings2, dependencies = {}) {
12020
12028
  } catch {
12021
12029
  resolvedInstallId = undefined;
12022
12030
  }
12023
- return validInstallId(resolvedInstallId) ? resolvedInstallId : undefined;
12031
+ return isUUID2(resolvedInstallId) ? resolvedInstallId : undefined;
12024
12032
  }
12025
12033
  function debugPayload(payload) {
12026
12034
  try {
@@ -12211,7 +12219,7 @@ async function trackCliOnboardingEvent(cfg, onboardingRunID, event, properties =
12211
12219
  return;
12212
12220
  if (!cfg.active_account?.session.access_token)
12213
12221
  return;
12214
- if (!isUUID2(onboardingRunID))
12222
+ if (!isUUID3(onboardingRunID))
12215
12223
  return;
12216
12224
  const input = {
12217
12225
  event,
@@ -12234,7 +12242,7 @@ async function trackCliOnboardingPreAuthEvent(onboardingRunID, event, properties
12234
12242
  return;
12235
12243
  if (!analyticsReleaseEnabled())
12236
12244
  return;
12237
- if (!isUUID2(onboardingRunID))
12245
+ if (!isUUID3(onboardingRunID))
12238
12246
  return;
12239
12247
  const input = {
12240
12248
  event,
@@ -12267,13 +12275,14 @@ function analyticsReleaseEnabled() {
12267
12275
  return Boolean(parsePostHogProjectToken(process.env.DOSU_POSTHOG_PROJECT_TOKEN_OVERRIDE ?? "phc_Uo9RxhN0HRk8gZkPlT18BCr7eqsM0MPWVW88HZB95V5"));
12268
12276
  }
12269
12277
  function baseProperties(cfg) {
12278
+ const orgId = cfg.active_account?.target?.org_id;
12270
12279
  return {
12271
12280
  cli_version: safeIdentifier(VERSION, 32),
12272
12281
  install_channel: safeIdentifier(INSTALL_CHANNEL, 32),
12273
12282
  platform: safeIdentifier(process.platform, 24),
12274
12283
  arch: safeIdentifier(process.arch, 24),
12275
12284
  mode: cfg.mode ?? "cloud",
12276
- org_id: safeIdentifier(cfg.active_account?.target?.org_id, 128),
12285
+ ...orgId && isUUID3(orgId) ? { org_id: orgId, $groups: { organization: orgId } } : {},
12277
12286
  deployment_id: safeIdentifier(cfg.active_account?.target?.deployment_id, 128),
12278
12287
  space_id: safeIdentifier(cfg.active_account?.target?.space_id, 128)
12279
12288
  };
@@ -12316,7 +12325,7 @@ function allowlistedWorkflowProperties(properties) {
12316
12325
  function safeIdentifier(value, maxLength) {
12317
12326
  return typeof value === "string" && value.length <= maxLength && /^[A-Za-z0-9][A-Za-z0-9._+-]*$/.test(value) ? value : undefined;
12318
12327
  }
12319
- function isUUID2(value) {
12328
+ function isUUID3(value) {
12320
12329
  return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
12321
12330
  }
12322
12331
  function createAnalyticsClient(accessToken, requestSignal) {
@@ -17870,10 +17879,12 @@ function commandTelemetryContext() {
17870
17879
  const tokenUserID = getAccessTokenUserID(accessToken);
17871
17880
  const userID = configUserID && configUserID === tokenUserID ? configUserID : undefined;
17872
17881
  const email = userID ? getAccessTokenEmail(accessToken) : undefined;
17882
+ const orgId = userID ? cfg.active_account?.target?.org_id : undefined;
17873
17883
  return {
17874
17884
  mode: cfg.mode === MODE_OSS ? "oss" : "cloud",
17875
17885
  isAuthenticated: authenticated,
17876
- ...userID ? { user: { id: userID, ...email ? { email } : {} } } : {}
17886
+ ...userID ? { user: { id: userID, ...email ? { email } : {} } } : {},
17887
+ ...orgId ? { orgId } : {}
17877
17888
  };
17878
17889
  } catch {
17879
17890
  return { mode: "cloud", isAuthenticated: false };
@@ -18339,4 +18350,4 @@ execute().catch((err) => {
18339
18350
  process.exit(1);
18340
18351
  });
18341
18352
 
18342
- //# debugId=61606b23-6c2b-78a9-6475-6e2164756e21
18353
+ //# debugId=11869608-d7a8-aa45-6475-6e2164756e21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosu/cli",
3
- "version": "0.52.1",
3
+ "version": "0.52.2",
4
4
  "type": "module",
5
5
  "description": "Dosu CLI - Manage MCP servers for AI tools",
6
6
  "license": "MIT",