@dosu/cli 0.52.1 → 0.52.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.
Files changed (2) hide show
  1. package/bin/dosu.js +199 -157
  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.3", 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 = {};
@@ -10226,6 +10226,14 @@ function mcpURL(deploymentID) {
10226
10226
  function mcpBaseURL() {
10227
10227
  return `${getBackendURL()}/v1/mcp`;
10228
10228
  }
10229
+ function mcpEndpoint(cfg) {
10230
+ if (cfg.mode === MODE_OSS)
10231
+ return mcpBaseURL();
10232
+ const deploymentID = cfg.active_account?.target?.deployment_id;
10233
+ if (!deploymentID)
10234
+ throw new Error("deployment ID is required");
10235
+ return mcpURL(deploymentID);
10236
+ }
10229
10237
  function mcpHeaders(apiKey) {
10230
10238
  if (!apiKey) {
10231
10239
  throw new Error("API key is required. Run 'dosu setup' to create one.");
@@ -10252,18 +10260,23 @@ function mcpRemoteServer(url, apiKey) {
10252
10260
  };
10253
10261
  }
10254
10262
  function loadJSONConfig(path3) {
10263
+ try {
10264
+ return readJSONConfig(path3);
10265
+ } catch {
10266
+ return {};
10267
+ }
10268
+ }
10269
+ function readJSONConfig(path3) {
10255
10270
  if (!existsSync7(path3))
10256
10271
  return {};
10257
- let data = readFileSync8(path3, "utf-8").trim();
10258
- if (!data)
10272
+ const raw = readFileSync8(path3, "utf-8").trim();
10273
+ if (!raw)
10259
10274
  return {};
10260
- if (path3.endsWith(".jsonc")) {
10261
- data = stripJSONComments(data);
10262
- }
10263
10275
  try {
10264
- return JSON.parse(data);
10265
- } catch {
10266
- return {};
10276
+ return JSON.parse(stripTrailingCommas(stripJSONComments(raw)));
10277
+ } catch (err) {
10278
+ const detail = err.message;
10279
+ throw new Error(`Could not parse ${path3} as JSON (${detail}). Fix the file and retry.`);
10267
10280
  }
10268
10281
  }
10269
10282
  function stripJSONComments(data) {
@@ -10271,25 +10284,7 @@ function stripJSONComments(data) {
10271
10284
  let i2 = 0;
10272
10285
  while (i2 < data.length) {
10273
10286
  if (data[i2] === '"') {
10274
- result.push(data[i2]);
10275
- i2++;
10276
- while (i2 < data.length && data[i2] !== '"') {
10277
- if (data[i2] === "\\") {
10278
- result.push(data[i2]);
10279
- i2++;
10280
- if (i2 < data.length) {
10281
- result.push(data[i2]);
10282
- i2++;
10283
- }
10284
- continue;
10285
- }
10286
- result.push(data[i2]);
10287
- i2++;
10288
- }
10289
- if (i2 < data.length) {
10290
- result.push(data[i2]);
10291
- i2++;
10292
- }
10287
+ i2 = copyStringLiteral(data, i2, result);
10293
10288
  continue;
10294
10289
  }
10295
10290
  if (i2 + 1 < data.length && data[i2] === "/" && data[i2 + 1] === "/") {
@@ -10303,8 +10298,7 @@ function stripJSONComments(data) {
10303
10298
  i2 += 2;
10304
10299
  while (i2 + 1 < data.length && !(data[i2] === "*" && data[i2 + 1] === "/"))
10305
10300
  i2++;
10306
- if (i2 + 1 < data.length)
10307
- i2 += 2;
10301
+ i2 = i2 + 1 < data.length ? i2 + 2 : data.length;
10308
10302
  continue;
10309
10303
  }
10310
10304
  result.push(data[i2]);
@@ -10312,6 +10306,43 @@ function stripJSONComments(data) {
10312
10306
  }
10313
10307
  return result.join("");
10314
10308
  }
10309
+ function copyStringLiteral(data, start, out) {
10310
+ let i2 = start + 1;
10311
+ out.push('"');
10312
+ while (i2 < data.length && data[i2] !== '"') {
10313
+ out.push(data[i2]);
10314
+ if (data[i2] === "\\" && i2 + 1 < data.length)
10315
+ out.push(data[++i2]);
10316
+ i2++;
10317
+ }
10318
+ if (i2 < data.length) {
10319
+ out.push('"');
10320
+ i2++;
10321
+ }
10322
+ return i2;
10323
+ }
10324
+ function stripTrailingCommas(data) {
10325
+ const result = [];
10326
+ let i2 = 0;
10327
+ while (i2 < data.length) {
10328
+ if (data[i2] === '"') {
10329
+ i2 = copyStringLiteral(data, i2, result);
10330
+ continue;
10331
+ }
10332
+ if (data[i2] === ",") {
10333
+ let j = i2 + 1;
10334
+ while (j < data.length && /\s/.test(data[j]))
10335
+ j++;
10336
+ if (data[j] === "}" || data[j] === "]") {
10337
+ i2++;
10338
+ continue;
10339
+ }
10340
+ }
10341
+ result.push(data[i2]);
10342
+ i2++;
10343
+ }
10344
+ return result.join("");
10345
+ }
10315
10346
  function saveJSONConfig(path3, cfg) {
10316
10347
  writeSecureFile(path3, JSON.stringify(cfg, null, 2));
10317
10348
  }
@@ -10330,7 +10361,7 @@ function isJSONKeyConfigured(configPath, topLevelKey) {
10330
10361
  return "dosu" in section;
10331
10362
  }
10332
10363
  function installJSONServer(configPath, topKey, server) {
10333
- const jsonCfg = loadJSONConfig(configPath);
10364
+ const jsonCfg = readJSONConfig(configPath);
10334
10365
  let section = jsonCfg[topKey];
10335
10366
  if (typeof section !== "object" || section === null) {
10336
10367
  section = {};
@@ -10342,18 +10373,19 @@ function installJSONServer(configPath, topKey, server) {
10342
10373
  function removeJSONServer(configPath, topKey) {
10343
10374
  let jsonCfg;
10344
10375
  try {
10345
- jsonCfg = loadJSONConfig(configPath);
10376
+ jsonCfg = readJSONConfig(configPath);
10346
10377
  } catch {
10347
10378
  return;
10348
10379
  }
10349
10380
  const section = jsonCfg[topKey];
10350
- if (typeof section === "object" && section !== null) {
10351
- delete section.dosu;
10352
- }
10381
+ if (typeof section !== "object" || section === null || !("dosu" in section))
10382
+ return;
10383
+ delete section.dosu;
10353
10384
  saveJSONConfig(configPath, jsonCfg);
10354
10385
  }
10355
10386
  var import_write_file_atomic, writeFileAtomic, MCP_REMOTE_VERSION = "0.1.38";
10356
10387
  var init_config_helpers = __esm(() => {
10388
+ init_config();
10357
10389
  import_write_file_atomic = __toESM(require_lib(), 1);
10358
10390
  writeFileAtomic = import_write_file_atomic.default;
10359
10391
  });
@@ -10404,16 +10436,6 @@ var init_detect = () => {};
10404
10436
 
10405
10437
  // src/mcp/providers/base.ts
10406
10438
  function createJSONProvider(opts) {
10407
- const defaultBuildServer = (cfg) => ({
10408
- type: "http",
10409
- url: mcpURL(cfg.active_account.target.deployment_id),
10410
- headers: mcpHeaders(cfg.active_account?.target?.api_key)
10411
- });
10412
- const defaultBuildOSSServer = (cfg) => ({
10413
- type: "http",
10414
- url: mcpBaseURL(),
10415
- headers: mcpHeaders(cfg.active_account?.target?.api_key)
10416
- });
10417
10439
  const buildServer = opts.buildServer ?? defaultBuildServer;
10418
10440
  return {
10419
10441
  name: () => opts.providerName,
@@ -10425,8 +10447,10 @@ function createJSONProvider(opts) {
10425
10447
  globalConfigPath: () => expandHome(opts.globalPath),
10426
10448
  isConfigured: () => isJSONKeyConfigured(expandHome(opts.globalPath), opts.topKey),
10427
10449
  install(cfg, global) {
10428
- if (cfg.mode !== MODE_OSS && !cfg.active_account?.target?.deployment_id)
10429
- throw new Error("deployment ID is required");
10450
+ const endpoint = {
10451
+ url: mcpEndpoint(cfg),
10452
+ headers: mcpHeaders(cfg.active_account?.target?.api_key)
10453
+ };
10430
10454
  let configPath;
10431
10455
  if (global) {
10432
10456
  configPath = expandHome(opts.globalPath);
@@ -10435,8 +10459,7 @@ function createJSONProvider(opts) {
10435
10459
  } else {
10436
10460
  throw new Error(`${opts.providerName} does not support local installation`);
10437
10461
  }
10438
- const serverBuilder = cfg.mode === MODE_OSS ? defaultBuildOSSServer : buildServer;
10439
- installJSONServer(configPath, opts.topKey, serverBuilder(cfg));
10462
+ installJSONServer(configPath, opts.topKey, buildServer(endpoint, cfg));
10440
10463
  },
10441
10464
  remove(global) {
10442
10465
  let configPath;
@@ -10451,8 +10474,12 @@ function createJSONProvider(opts) {
10451
10474
  }
10452
10475
  };
10453
10476
  }
10477
+ var defaultBuildServer = ({ url, headers }) => ({
10478
+ type: "http",
10479
+ url,
10480
+ headers
10481
+ });
10454
10482
  var init_base = __esm(() => {
10455
- init_config();
10456
10483
  init_config_helpers();
10457
10484
  init_detect();
10458
10485
  });
@@ -10466,13 +10493,12 @@ var AntigravityProvider = () => createJSONProvider({
10466
10493
  paths: ["~/.gemini"],
10467
10494
  globalPath: "~/.gemini/antigravity/mcp_config.json",
10468
10495
  topKey: "mcpServers",
10469
- buildServer: (cfg) => ({
10470
- serverUrl: mcpURL(cfg.active_account.target.deployment_id),
10471
- headers: mcpHeaders(cfg.active_account.target.api_key)
10496
+ buildServer: ({ url, headers }) => ({
10497
+ serverUrl: url,
10498
+ headers
10472
10499
  })
10473
10500
  });
10474
10501
  var init_antigravity = __esm(() => {
10475
- init_config_helpers();
10476
10502
  init_base();
10477
10503
  });
10478
10504
 
@@ -10509,9 +10535,7 @@ var ClaudeDesktopProvider = () => ({
10509
10535
  install(cfg, global) {
10510
10536
  if (!global)
10511
10537
  throw new Error("Claude Desktop does not support local installation");
10512
- if (cfg.mode !== MODE_OSS && !cfg.active_account?.target?.deployment_id)
10513
- throw new Error("deployment ID is required");
10514
- const url = cfg.mode === MODE_OSS ? mcpBaseURL() : mcpURL(cfg.active_account.target.deployment_id);
10538
+ const url = mcpEndpoint(cfg);
10515
10539
  const npx = findNpx();
10516
10540
  const remote = mcpRemoteServer(url, cfg.active_account?.target?.api_key);
10517
10541
  installJSONServer(configPath(), "mcpServers", {
@@ -10527,7 +10551,6 @@ var ClaudeDesktopProvider = () => ({
10527
10551
  }
10528
10552
  });
10529
10553
  var init_claude_desktop = __esm(() => {
10530
- init_config();
10531
10554
  init_config_helpers();
10532
10555
  init_detect();
10533
10556
  });
@@ -10542,15 +10565,14 @@ var extensionDir = () => join11(appSupportDir(), "Code", "User", "globalStorage"
10542
10565
  paths: [extensionDir()],
10543
10566
  globalPath: join11(extensionDir(), "settings", "cline_mcp_settings.json"),
10544
10567
  topKey: "mcpServers",
10545
- buildServer: (cfg) => ({
10546
- url: mcpURL(cfg.active_account.target.deployment_id),
10568
+ buildServer: ({ url, headers }) => ({
10569
+ url,
10547
10570
  type: "streamableHttp",
10548
10571
  disabled: false,
10549
- headers: mcpHeaders(cfg.active_account.target.api_key)
10572
+ headers
10550
10573
  })
10551
10574
  });
10552
10575
  var init_cline = __esm(() => {
10553
- init_config_helpers();
10554
10576
  init_detect();
10555
10577
  init_base();
10556
10578
  });
@@ -10568,15 +10590,14 @@ var ClineCliProvider = () => createJSONProvider({
10568
10590
  paths: [clineDir()],
10569
10591
  globalPath: join12(clineDir(), "data", "settings", "cline_mcp_settings.json"),
10570
10592
  topKey: "mcpServers",
10571
- buildServer: (cfg) => ({
10572
- url: mcpURL(cfg.active_account.target.deployment_id),
10593
+ buildServer: ({ url, headers }) => ({
10594
+ url,
10573
10595
  type: "streamableHttp",
10574
10596
  disabled: false,
10575
- headers: mcpHeaders(cfg.active_account.target.api_key)
10597
+ headers
10576
10598
  })
10577
10599
  });
10578
10600
  var init_cline_cli = __esm(() => {
10579
- init_config_helpers();
10580
10601
  init_detect();
10581
10602
  init_base();
10582
10603
  });
@@ -10600,13 +10621,6 @@ function readTOML(path3) {
10600
10621
  function writeTOML(path3, content) {
10601
10622
  writeSecureFile(path3, content);
10602
10623
  }
10603
- function mcpEndpoint(cfg) {
10604
- if (cfg.mode === MODE_OSS)
10605
- return mcpBaseURL();
10606
- if (!cfg.active_account?.target?.deployment_id)
10607
- throw new Error("deployment ID is required");
10608
- return mcpURL(cfg.active_account?.target?.deployment_id);
10609
- }
10610
10624
  function tomlString(value) {
10611
10625
  return `"${value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
10612
10626
  }
@@ -10689,13 +10703,6 @@ function globalPath() {
10689
10703
  }
10690
10704
  return expandHome("~/.copilot/mcp-config.json");
10691
10705
  }
10692
- function mcpEndpoint2(cfg) {
10693
- if (cfg.mode === MODE_OSS)
10694
- return mcpBaseURL();
10695
- if (!cfg.active_account?.target?.deployment_id)
10696
- throw new Error("deployment ID is required");
10697
- return mcpURL(cfg.active_account?.target?.deployment_id);
10698
- }
10699
10706
  var CopilotProvider = () => ({
10700
10707
  name: () => "GitHub Copilot CLI",
10701
10708
  id: () => "copilot",
@@ -10706,7 +10713,7 @@ var CopilotProvider = () => ({
10706
10713
  globalConfigPath: () => globalPath(),
10707
10714
  isConfigured: () => isJSONKeyConfigured(globalPath(), "mcpServers"),
10708
10715
  install(cfg, global) {
10709
- const url = mcpEndpoint2(cfg);
10716
+ const url = mcpEndpoint(cfg);
10710
10717
  if (global) {
10711
10718
  const server = {
10712
10719
  type: "http",
@@ -10735,7 +10742,6 @@ var CopilotProvider = () => ({
10735
10742
  }
10736
10743
  });
10737
10744
  var init_copilot = __esm(() => {
10738
- init_config();
10739
10745
  init_config_helpers();
10740
10746
  init_detect();
10741
10747
  });
@@ -10750,14 +10756,13 @@ var CursorProvider = () => createJSONProvider({
10750
10756
  paths: ["~/.cursor"],
10751
10757
  globalPath: "~/.cursor/mcp.json",
10752
10758
  topKey: "mcpServers",
10753
- buildServer: (cfg) => ({
10754
- url: mcpURL(cfg.active_account.target.deployment_id),
10755
- headers: mcpHeaders(cfg.active_account.target.api_key)
10759
+ buildServer: ({ url, headers }) => ({
10760
+ url,
10761
+ headers
10756
10762
  }),
10757
10763
  localConfigPath: (cwd) => join15(cwd, ".cursor", "mcp.json")
10758
10764
  });
10759
10765
  var init_cursor = __esm(() => {
10760
- init_config_helpers();
10761
10766
  init_base();
10762
10767
  });
10763
10768
 
@@ -10794,13 +10799,6 @@ var init_gemini = __esm(() => {
10794
10799
  });
10795
10800
 
10796
10801
  // src/mcp/providers/manual.ts
10797
- function mcpEndpoint3(cfg) {
10798
- if (cfg.mode === MODE_OSS)
10799
- return mcpBaseURL();
10800
- if (!cfg.active_account?.target?.deployment_id)
10801
- throw new Error("deployment ID is required");
10802
- return mcpURL(cfg.active_account?.target?.deployment_id);
10803
- }
10804
10802
  function maskSecret(secret) {
10805
10803
  if (secret.length <= 8)
10806
10804
  return "[hidden]";
@@ -10812,7 +10810,7 @@ var ManualProvider = () => ({
10812
10810
  id: () => "manual",
10813
10811
  supportsLocal: () => false,
10814
10812
  install(cfg, _global, opts = {}) {
10815
- const url = mcpEndpoint3(cfg);
10813
+ const url = mcpEndpoint(cfg);
10816
10814
  const apiKey = mcpHeaders(cfg.active_account?.target?.api_key)["X-Dosu-API-Key"];
10817
10815
  const headerValue = opts.showSecret ? apiKey : maskSecret(apiKey);
10818
10816
  console.log("Use these details to configure the Dosu MCP server in your client:");
@@ -10832,7 +10830,6 @@ To remove the Dosu MCP server, manually delete the configuration from your clien
10832
10830
  }
10833
10831
  });
10834
10832
  var init_manual = __esm(() => {
10835
- init_config();
10836
10833
  init_config_helpers();
10837
10834
  });
10838
10835
 
@@ -10848,13 +10845,6 @@ function resolveGlobalConfigPath() {
10848
10845
  return jsoncPath;
10849
10846
  return jsonPath;
10850
10847
  }
10851
- function mcpEndpoint4(cfg) {
10852
- if (cfg.mode === MODE_OSS)
10853
- return mcpBaseURL();
10854
- if (!cfg.active_account?.target?.deployment_id)
10855
- throw new Error("deployment ID is required");
10856
- return mcpURL(cfg.active_account?.target?.deployment_id);
10857
- }
10858
10848
  var MCPorterProvider = () => ({
10859
10849
  name: () => "MCPorter",
10860
10850
  id: () => "mcporter",
@@ -10868,7 +10858,7 @@ var MCPorterProvider = () => ({
10868
10858
  const configPath2 = global ? resolveGlobalConfigPath() : join18(process.cwd(), "config", "mcporter.json");
10869
10859
  const server = {
10870
10860
  type: "http",
10871
- url: mcpEndpoint4(cfg),
10861
+ url: mcpEndpoint(cfg),
10872
10862
  headers: mcpHeaders(cfg.active_account.target.api_key)
10873
10863
  };
10874
10864
  installJSONServer(configPath2, "mcpServers", server);
@@ -10879,7 +10869,6 @@ var MCPorterProvider = () => ({
10879
10869
  }
10880
10870
  });
10881
10871
  var init_mcporter = __esm(() => {
10882
- init_config();
10883
10872
  init_config_helpers();
10884
10873
  init_detect();
10885
10874
  });
@@ -10894,16 +10883,15 @@ var OpenCodeProvider = () => createJSONProvider({
10894
10883
  paths: ["~/.config/opencode"],
10895
10884
  globalPath: "~/.config/opencode/opencode.json",
10896
10885
  topKey: "mcp",
10897
- buildServer: (cfg) => ({
10886
+ buildServer: ({ url, headers }) => ({
10898
10887
  type: "remote",
10899
- url: mcpURL(cfg.active_account.target.deployment_id),
10888
+ url,
10900
10889
  enabled: true,
10901
- headers: mcpHeaders(cfg.active_account.target.api_key)
10890
+ headers
10902
10891
  }),
10903
10892
  localConfigPath: (cwd) => join19(cwd, "opencode.json")
10904
10893
  });
10905
10894
  var init_opencode = __esm(() => {
10906
- init_config_helpers();
10907
10895
  init_base();
10908
10896
  });
10909
10897
 
@@ -10941,30 +10929,73 @@ var init_windsurf = __esm(() => {
10941
10929
  });
10942
10930
 
10943
10931
  // src/mcp/providers/zed.ts
10944
- import { platform as platform3 } from "node:os";
10932
+ import { rmSync as rmSync2 } from "node:fs";
10933
+ import { homedir as homedir4, platform as platform3 } from "node:os";
10945
10934
  import { join as join22 } from "node:path";
10946
10935
  function zedConfigDir() {
10947
10936
  const os2 = platform3();
10948
- if (os2 === "darwin" || os2 === "win32")
10937
+ if (os2 === "win32")
10949
10938
  return join22(appSupportDir(), "Zed");
10939
+ if (os2 === "darwin")
10940
+ return join22(homedir4(), ".config", "zed");
10950
10941
  return join22(appSupportDir(), "zed");
10951
10942
  }
10952
- var ZedProvider = () => createJSONProvider({
10953
- providerName: "Zed",
10954
- providerID: "zed",
10955
- local: true,
10956
- priorityValue: 10,
10957
- paths: [zedConfigDir()],
10958
- globalPath: join22(zedConfigDir(), "settings.json"),
10959
- topKey: "context_servers",
10960
- buildServer: (cfg) => ({
10961
- source: "custom",
10962
- type: "http",
10963
- url: mcpURL(cfg.active_account.target.deployment_id),
10964
- headers: mcpHeaders(cfg.active_account.target.api_key)
10965
- }),
10966
- localConfigPath: (cwd) => join22(cwd, ".zed", "settings.json")
10967
- });
10943
+ function zedDataDir() {
10944
+ const os2 = platform3();
10945
+ if (os2 === "darwin")
10946
+ return join22(appSupportDir(), "Zed");
10947
+ if (os2 === "win32")
10948
+ return join22(process.env.LOCALAPPDATA ?? "", "Zed");
10949
+ return join22(process.env.XDG_DATA_HOME ?? join22(homedir4(), ".local", "share"), "zed");
10950
+ }
10951
+ function legacyDarwinSettingsPath() {
10952
+ return platform3() === "darwin" ? join22(appSupportDir(), "Zed", "settings.json") : null;
10953
+ }
10954
+ function removeLegacyDosuEntry(path3) {
10955
+ let cfg;
10956
+ try {
10957
+ cfg = readJSONConfig(path3);
10958
+ } catch {
10959
+ return;
10960
+ }
10961
+ const servers = cfg.context_servers;
10962
+ if (typeof servers !== "object" || servers === null || !("dosu" in servers))
10963
+ return;
10964
+ delete servers.dosu;
10965
+ const nothingElse = Object.keys(cfg).length === 1 && Object.keys(servers).length === 0;
10966
+ if (nothingElse)
10967
+ rmSync2(path3, { force: true });
10968
+ else
10969
+ saveJSONConfig(path3, cfg);
10970
+ }
10971
+ var ZedProvider = (legacyPath = legacyDarwinSettingsPath()) => {
10972
+ const provider = createJSONProvider({
10973
+ providerName: "Zed",
10974
+ providerID: "zed",
10975
+ local: true,
10976
+ priorityValue: 10,
10977
+ paths: [zedConfigDir(), zedDataDir()],
10978
+ globalPath: join22(zedConfigDir(), "settings.json"),
10979
+ topKey: "context_servers",
10980
+ buildServer: ({ url, headers }) => ({ url, headers }),
10981
+ localConfigPath: (cwd) => join22(cwd, ".zed", "settings.json")
10982
+ });
10983
+ if (!legacyPath)
10984
+ return provider;
10985
+ return {
10986
+ ...provider,
10987
+ install(cfg, global) {
10988
+ provider.install(cfg, global);
10989
+ if (global)
10990
+ removeLegacyDosuEntry(legacyPath);
10991
+ },
10992
+ remove(global) {
10993
+ provider.remove(global);
10994
+ if (global)
10995
+ removeLegacyDosuEntry(legacyPath);
10996
+ }
10997
+ };
10998
+ };
10968
10999
  var init_zed = __esm(() => {
10969
11000
  init_config_helpers();
10970
11001
  init_detect();
@@ -11023,13 +11054,13 @@ var init_providers = __esm(() => {
11023
11054
 
11024
11055
  // src/rules/installer.ts
11025
11056
  import { existsSync as existsSync11, mkdirSync as mkdirSync7, readFileSync as readFileSync10, unlinkSync as unlinkSync2, writeFileSync as writeFileSync7 } from "node:fs";
11026
- import { homedir as homedir4 } from "node:os";
11057
+ import { homedir as homedir5 } from "node:os";
11027
11058
  import { dirname as dirname4, join as join23 } from "node:path";
11028
11059
  function claudeConfigDir() {
11029
- return process.env.CLAUDE_CONFIG_DIR || join23(homedir4(), ".claude");
11060
+ return process.env.CLAUDE_CONFIG_DIR || join23(homedir5(), ".claude");
11030
11061
  }
11031
11062
  function codexHome2() {
11032
- return process.env.CODEX_HOME || join23(homedir4(), ".codex");
11063
+ return process.env.CODEX_HOME || join23(homedir5(), ".codex");
11033
11064
  }
11034
11065
  function isRuleAgent(agent) {
11035
11066
  return Object.hasOwn(RULE_TARGETS, agent);
@@ -11175,7 +11206,7 @@ var init_installer = __esm(() => {
11175
11206
  },
11176
11207
  cursor: {
11177
11208
  kind: "file",
11178
- path: () => join23(homedir4(), ".cursor", "rules", "dosu.mdc"),
11209
+ path: () => join23(homedir5(), ".cursor", "rules", "dosu.mdc"),
11179
11210
  cursorFrontmatter: true
11180
11211
  },
11181
11212
  codex: {
@@ -11184,15 +11215,15 @@ var init_installer = __esm(() => {
11184
11215
  },
11185
11216
  opencode: {
11186
11217
  kind: "section",
11187
- path: () => join23(homedir4(), ".config", "opencode", "AGENTS.md")
11218
+ path: () => join23(homedir5(), ".config", "opencode", "AGENTS.md")
11188
11219
  },
11189
11220
  gemini: {
11190
11221
  kind: "section",
11191
- path: () => join23(homedir4(), ".gemini", "GEMINI.md")
11222
+ path: () => join23(homedir5(), ".gemini", "GEMINI.md")
11192
11223
  },
11193
11224
  antigravity: {
11194
11225
  kind: "section",
11195
- path: () => join23(homedir4(), ".gemini", "GEMINI.md")
11226
+ path: () => join23(homedir5(), ".gemini", "GEMINI.md")
11196
11227
  }
11197
11228
  };
11198
11229
  });
@@ -11444,7 +11475,7 @@ var init_settings = __esm(() => {
11444
11475
  });
11445
11476
 
11446
11477
  // src/telemetry/debug-id.ts
11447
- var BUNDLE_DEBUG_ID_PLACEHOLDER = "61606b23-6c2b-78a9-6475-6e2164756e21";
11478
+ var BUNDLE_DEBUG_ID_PLACEHOLDER = "222d1353-0757-fab1-6475-6e2164756e21";
11448
11479
 
11449
11480
  // src/telemetry/telemetry.ts
11450
11481
  import { randomUUID as randomUUID3 } from "node:crypto";
@@ -11473,11 +11504,13 @@ function normalizeContext(context) {
11473
11504
  const isAuthenticated2 = context?.isAuthenticated === true;
11474
11505
  const id = safeRead(context?.user, "id");
11475
11506
  const email = safeRead(context?.user, "email");
11476
- const user = isAuthenticated2 && validUserId(id) ? { id, ...validEmail(email) ? { email } : {} } : undefined;
11507
+ const orgId = safeRead(context, "orgId");
11508
+ const user = isAuthenticated2 && isUUID2(id) ? { id, ...validEmail(email) ? { email } : {} } : undefined;
11477
11509
  return {
11478
11510
  mode: context?.mode === "oss" ? "oss" : "cloud",
11479
11511
  isAuthenticated: isAuthenticated2,
11480
- ...user ? { user } : {}
11512
+ ...user ? { user } : {},
11513
+ ...user && isUUID2(orgId) ? { orgId } : {}
11481
11514
  };
11482
11515
  }
11483
11516
  function normalizeExitCode(value, fallback = 1) {
@@ -11497,12 +11530,9 @@ function normalizeRuntime(runtime) {
11497
11530
  isTty: runtime.isTty === true
11498
11531
  };
11499
11532
  }
11500
- function validInstallId(value) {
11533
+ function isUUID2(value) {
11501
11534
  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
11535
  }
11503
- function validUserId(value) {
11504
- return validInstallId(value);
11505
- }
11506
11536
  function validEmail(value) {
11507
11537
  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
11538
  }
@@ -11652,7 +11682,7 @@ function buildPostHogPayload(input) {
11652
11682
  const result = input.result === "success" || input.result === "validation_error" ? input.result : "failure";
11653
11683
  return {
11654
11684
  api_key: input.apiKey,
11655
- distinct_id: context.user?.id ?? (validInstallId(input.installId) ? input.installId : FALLBACK_INSTALL_ID),
11685
+ distinct_id: context.user?.id ?? (isUUID2(input.installId) ? input.installId : FALLBACK_INSTALL_ID),
11656
11686
  event: "cli_command_completed",
11657
11687
  properties: {
11658
11688
  $geoip_disable: true,
@@ -11670,6 +11700,10 @@ function buildPostHogPayload(input) {
11670
11700
  is_ci: runtime.isCi,
11671
11701
  is_tty: runtime.isTty,
11672
11702
  mode: context.mode,
11703
+ ...context.orgId ? {
11704
+ org_id: context.orgId,
11705
+ $groups: { organization: context.orgId }
11706
+ } : {},
11673
11707
  is_authenticated: context.isAuthenticated,
11674
11708
  exit_code: normalizeExitCode(input.exitCode),
11675
11709
  ...errorCode ? { error_code: errorCode } : {}
@@ -11784,7 +11818,12 @@ function buildSentryEnvelope(input) {
11784
11818
  level: "error",
11785
11819
  release: `dosu-cli@${runtime.version}`,
11786
11820
  tags: sentryTags(command, context, runtime, error),
11787
- ...context.user ? { user: context.user } : {},
11821
+ ...context.user ? {
11822
+ user: {
11823
+ id: context.user.id,
11824
+ ...context.user.email ? { email: context.user.email } : {}
11825
+ }
11826
+ } : {},
11788
11827
  ...mappedBundle ? {
11789
11828
  debug_meta: {
11790
11829
  images: [{ type: "sourcemap", code_file: BUNDLE_CODE_FILE, debug_id: debugId }]
@@ -11978,7 +12017,7 @@ function safeNow(now) {
11978
12017
  function safeUuid(generate) {
11979
12018
  try {
11980
12019
  const value = generate();
11981
- return validInstallId(value) ? value : undefined;
12020
+ return isUUID2(value) ? value : undefined;
11982
12021
  } catch {
11983
12022
  return;
11984
12023
  }
@@ -12010,7 +12049,7 @@ function createCommandTelemetry(settings2, dependencies = {}) {
12010
12049
  let installIdResolved = false;
12011
12050
  let resolvedInstallId = settings2.install_id;
12012
12051
  function installId() {
12013
- if (validInstallId(resolvedInstallId))
12052
+ if (isUUID2(resolvedInstallId))
12014
12053
  return resolvedInstallId;
12015
12054
  if (installIdResolved)
12016
12055
  return;
@@ -12020,7 +12059,7 @@ function createCommandTelemetry(settings2, dependencies = {}) {
12020
12059
  } catch {
12021
12060
  resolvedInstallId = undefined;
12022
12061
  }
12023
- return validInstallId(resolvedInstallId) ? resolvedInstallId : undefined;
12062
+ return isUUID2(resolvedInstallId) ? resolvedInstallId : undefined;
12024
12063
  }
12025
12064
  function debugPayload(payload) {
12026
12065
  try {
@@ -12211,7 +12250,7 @@ async function trackCliOnboardingEvent(cfg, onboardingRunID, event, properties =
12211
12250
  return;
12212
12251
  if (!cfg.active_account?.session.access_token)
12213
12252
  return;
12214
- if (!isUUID2(onboardingRunID))
12253
+ if (!isUUID3(onboardingRunID))
12215
12254
  return;
12216
12255
  const input = {
12217
12256
  event,
@@ -12234,7 +12273,7 @@ async function trackCliOnboardingPreAuthEvent(onboardingRunID, event, properties
12234
12273
  return;
12235
12274
  if (!analyticsReleaseEnabled())
12236
12275
  return;
12237
- if (!isUUID2(onboardingRunID))
12276
+ if (!isUUID3(onboardingRunID))
12238
12277
  return;
12239
12278
  const input = {
12240
12279
  event,
@@ -12267,13 +12306,14 @@ function analyticsReleaseEnabled() {
12267
12306
  return Boolean(parsePostHogProjectToken(process.env.DOSU_POSTHOG_PROJECT_TOKEN_OVERRIDE ?? "phc_Uo9RxhN0HRk8gZkPlT18BCr7eqsM0MPWVW88HZB95V5"));
12268
12307
  }
12269
12308
  function baseProperties(cfg) {
12309
+ const orgId = cfg.active_account?.target?.org_id;
12270
12310
  return {
12271
12311
  cli_version: safeIdentifier(VERSION, 32),
12272
12312
  install_channel: safeIdentifier(INSTALL_CHANNEL, 32),
12273
12313
  platform: safeIdentifier(process.platform, 24),
12274
12314
  arch: safeIdentifier(process.arch, 24),
12275
12315
  mode: cfg.mode ?? "cloud",
12276
- org_id: safeIdentifier(cfg.active_account?.target?.org_id, 128),
12316
+ ...orgId && isUUID3(orgId) ? { org_id: orgId, $groups: { organization: orgId } } : {},
12277
12317
  deployment_id: safeIdentifier(cfg.active_account?.target?.deployment_id, 128),
12278
12318
  space_id: safeIdentifier(cfg.active_account?.target?.space_id, 128)
12279
12319
  };
@@ -12316,7 +12356,7 @@ function allowlistedWorkflowProperties(properties) {
12316
12356
  function safeIdentifier(value, maxLength) {
12317
12357
  return typeof value === "string" && value.length <= maxLength && /^[A-Za-z0-9][A-Za-z0-9._+-]*$/.test(value) ? value : undefined;
12318
12358
  }
12319
- function isUUID2(value) {
12359
+ function isUUID3(value) {
12320
12360
  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
12361
  }
12322
12362
  function createAnalyticsClient(accessToken, requestSignal) {
@@ -12488,7 +12528,7 @@ var init_agent_kickoff = __esm(() => {
12488
12528
 
12489
12529
  // src/setup/logs-handoff.ts
12490
12530
  import { existsSync as existsSync15, readdirSync, statSync as statSync3 } from "node:fs";
12491
- import { homedir as homedir5 } from "node:os";
12531
+ import { homedir as homedir6 } from "node:os";
12492
12532
  import { join as join26 } from "node:path";
12493
12533
  function countJsonlFiles(root, cap = COUNT_CAP) {
12494
12534
  if (!existsSync15(root))
@@ -12518,7 +12558,7 @@ function countJsonlFiles(root, cap = COUNT_CAP) {
12518
12558
  }
12519
12559
  return { count, capped: false };
12520
12560
  }
12521
- function detectLogSources(home = process.env.HOME || homedir5()) {
12561
+ function detectLogSources(home = process.env.HOME || homedir6()) {
12522
12562
  const roots = {
12523
12563
  cursor: join26(home, ".cursor", "projects"),
12524
12564
  claude: join26(home, ".claude", "projects"),
@@ -17489,7 +17529,7 @@ init_skill();
17489
17529
  var import_picocolors26 = __toESM(require_picocolors(), 1);
17490
17530
  import { spawnSync as spawnSync2 } from "node:child_process";
17491
17531
  import { realpathSync } from "node:fs";
17492
- import { homedir as homedir6 } from "node:os";
17532
+ import { homedir as homedir7 } from "node:os";
17493
17533
  import { posix, win32 } from "node:path";
17494
17534
  var PACKAGE_NAME = "@dosu/cli";
17495
17535
  var LATEST_PACKAGE = `${PACKAGE_NAME}@latest`;
@@ -17566,7 +17606,7 @@ function packageRoots(manager, platform4, comSpec, env, cwd) {
17566
17606
  manager === "npm" ? path3.join(lines[0], "@dosu", "cli") : path3.join(lines[0], "node_modules", "@dosu", "cli")
17567
17607
  ];
17568
17608
  }
17569
- function owningPackageManager(entrypoint, platform4, comSpec, env = process.env, cwd = homedir6()) {
17609
+ function owningPackageManager(entrypoint, platform4, comSpec, env = process.env, cwd = homedir7()) {
17570
17610
  const path3 = platform4 === "win32" ? win32 : posix;
17571
17611
  if (!entrypoint || !path3.isAbsolute(entrypoint))
17572
17612
  return null;
@@ -17619,7 +17659,7 @@ Or install Dosu globally with your package manager:`);
17619
17659
  function runUpgrade(channel = INSTALL_CHANNEL, options = {}) {
17620
17660
  const platform4 = options.platform ?? process.platform;
17621
17661
  const env = options.env ?? process.env;
17622
- const cwd = options.cwd ?? homedir6();
17662
+ const cwd = options.cwd ?? homedir7();
17623
17663
  let manager = null;
17624
17664
  if (channel === "npm") {
17625
17665
  if (isNpxInvocation(channel, env)) {
@@ -17870,10 +17910,12 @@ function commandTelemetryContext() {
17870
17910
  const tokenUserID = getAccessTokenUserID(accessToken);
17871
17911
  const userID = configUserID && configUserID === tokenUserID ? configUserID : undefined;
17872
17912
  const email = userID ? getAccessTokenEmail(accessToken) : undefined;
17913
+ const orgId = userID ? cfg.active_account?.target?.org_id : undefined;
17873
17914
  return {
17874
17915
  mode: cfg.mode === MODE_OSS ? "oss" : "cloud",
17875
17916
  isAuthenticated: authenticated,
17876
- ...userID ? { user: { id: userID, ...email ? { email } : {} } } : {}
17917
+ ...userID ? { user: { id: userID, ...email ? { email } : {} } } : {},
17918
+ ...orgId ? { orgId } : {}
17877
17919
  };
17878
17920
  } catch {
17879
17921
  return { mode: "cloud", isAuthenticated: false };
@@ -18339,4 +18381,4 @@ execute().catch((err) => {
18339
18381
  process.exit(1);
18340
18382
  });
18341
18383
 
18342
- //# debugId=61606b23-6c2b-78a9-6475-6e2164756e21
18384
+ //# debugId=222d1353-0757-fab1-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.3",
4
4
  "type": "module",
5
5
  "description": "Dosu CLI - Manage MCP servers for AI tools",
6
6
  "license": "MIT",