@dosu/cli 0.53.0-beta.15 → 0.53.0-beta.16

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 +197 -155
  2. package/package.json +1 -1
package/bin/dosu.js CHANGED
@@ -5018,7 +5018,7 @@ function isNpxInvocation(channel = INSTALL_CHANNEL, env = process.env) {
5018
5018
  function getVersionString() {
5019
5019
  return `v${VERSION}`;
5020
5020
  }
5021
- var VERSION = "0.53.0-beta.15", INSTALL_CHANNEL = "npm";
5021
+ var VERSION = "0.53.0-beta.16", INSTALL_CHANNEL = "npm";
5022
5022
 
5023
5023
  // src/debug/logger.ts
5024
5024
  import {
@@ -8000,6 +8000,14 @@ function mcpURL(deploymentID) {
8000
8000
  function mcpBaseURL() {
8001
8001
  return `${getBackendURL()}/v1/mcp`;
8002
8002
  }
8003
+ function mcpEndpoint(cfg) {
8004
+ if (cfg.mode === MODE_OSS)
8005
+ return mcpBaseURL();
8006
+ const deploymentID = cfg.active_account?.target?.deployment_id;
8007
+ if (!deploymentID)
8008
+ throw new Error("deployment ID is required");
8009
+ return mcpURL(deploymentID);
8010
+ }
8003
8011
  function mcpHeaders(apiKey) {
8004
8012
  if (!apiKey) {
8005
8013
  throw new Error("API key is required. Run 'dosu setup' to create one.");
@@ -8026,18 +8034,23 @@ function mcpRemoteServer(url, apiKey) {
8026
8034
  };
8027
8035
  }
8028
8036
  function loadJSONConfig(path3) {
8037
+ try {
8038
+ return readJSONConfig(path3);
8039
+ } catch {
8040
+ return {};
8041
+ }
8042
+ }
8043
+ function readJSONConfig(path3) {
8029
8044
  if (!existsSync7(path3))
8030
8045
  return {};
8031
- let data = readFileSync7(path3, "utf-8").trim();
8032
- if (!data)
8046
+ const raw = readFileSync7(path3, "utf-8").trim();
8047
+ if (!raw)
8033
8048
  return {};
8034
- if (path3.endsWith(".jsonc")) {
8035
- data = stripJSONComments(data);
8036
- }
8037
8049
  try {
8038
- return JSON.parse(data);
8039
- } catch {
8040
- return {};
8050
+ return JSON.parse(stripTrailingCommas(stripJSONComments(raw)));
8051
+ } catch (err) {
8052
+ const detail = err.message;
8053
+ throw new Error(`Could not parse ${path3} as JSON (${detail}). Fix the file and retry.`);
8041
8054
  }
8042
8055
  }
8043
8056
  function stripJSONComments(data) {
@@ -8045,25 +8058,7 @@ function stripJSONComments(data) {
8045
8058
  let i2 = 0;
8046
8059
  while (i2 < data.length) {
8047
8060
  if (data[i2] === '"') {
8048
- result.push(data[i2]);
8049
- i2++;
8050
- while (i2 < data.length && data[i2] !== '"') {
8051
- if (data[i2] === "\\") {
8052
- result.push(data[i2]);
8053
- i2++;
8054
- if (i2 < data.length) {
8055
- result.push(data[i2]);
8056
- i2++;
8057
- }
8058
- continue;
8059
- }
8060
- result.push(data[i2]);
8061
- i2++;
8062
- }
8063
- if (i2 < data.length) {
8064
- result.push(data[i2]);
8065
- i2++;
8066
- }
8061
+ i2 = copyStringLiteral(data, i2, result);
8067
8062
  continue;
8068
8063
  }
8069
8064
  if (i2 + 1 < data.length && data[i2] === "/" && data[i2 + 1] === "/") {
@@ -8077,10 +8072,46 @@ function stripJSONComments(data) {
8077
8072
  i2 += 2;
8078
8073
  while (i2 + 1 < data.length && !(data[i2] === "*" && data[i2 + 1] === "/"))
8079
8074
  i2++;
8080
- if (i2 + 1 < data.length)
8081
- i2 += 2;
8075
+ i2 = i2 + 1 < data.length ? i2 + 2 : data.length;
8076
+ continue;
8077
+ }
8078
+ result.push(data[i2]);
8079
+ i2++;
8080
+ }
8081
+ return result.join("");
8082
+ }
8083
+ function copyStringLiteral(data, start, out) {
8084
+ let i2 = start + 1;
8085
+ out.push('"');
8086
+ while (i2 < data.length && data[i2] !== '"') {
8087
+ out.push(data[i2]);
8088
+ if (data[i2] === "\\" && i2 + 1 < data.length)
8089
+ out.push(data[++i2]);
8090
+ i2++;
8091
+ }
8092
+ if (i2 < data.length) {
8093
+ out.push('"');
8094
+ i2++;
8095
+ }
8096
+ return i2;
8097
+ }
8098
+ function stripTrailingCommas(data) {
8099
+ const result = [];
8100
+ let i2 = 0;
8101
+ while (i2 < data.length) {
8102
+ if (data[i2] === '"') {
8103
+ i2 = copyStringLiteral(data, i2, result);
8082
8104
  continue;
8083
8105
  }
8106
+ if (data[i2] === ",") {
8107
+ let j = i2 + 1;
8108
+ while (j < data.length && /\s/.test(data[j]))
8109
+ j++;
8110
+ if (data[j] === "}" || data[j] === "]") {
8111
+ i2++;
8112
+ continue;
8113
+ }
8114
+ }
8084
8115
  result.push(data[i2]);
8085
8116
  i2++;
8086
8117
  }
@@ -8104,7 +8135,7 @@ function isJSONKeyConfigured(configPath, topLevelKey) {
8104
8135
  return "dosu" in section;
8105
8136
  }
8106
8137
  function installJSONServer(configPath, topKey, server) {
8107
- const jsonCfg = loadJSONConfig(configPath);
8138
+ const jsonCfg = readJSONConfig(configPath);
8108
8139
  let section = jsonCfg[topKey];
8109
8140
  if (typeof section !== "object" || section === null) {
8110
8141
  section = {};
@@ -8116,18 +8147,19 @@ function installJSONServer(configPath, topKey, server) {
8116
8147
  function removeJSONServer(configPath, topKey) {
8117
8148
  let jsonCfg;
8118
8149
  try {
8119
- jsonCfg = loadJSONConfig(configPath);
8150
+ jsonCfg = readJSONConfig(configPath);
8120
8151
  } catch {
8121
8152
  return;
8122
8153
  }
8123
8154
  const section = jsonCfg[topKey];
8124
- if (typeof section === "object" && section !== null) {
8125
- delete section.dosu;
8126
- }
8155
+ if (typeof section !== "object" || section === null || !("dosu" in section))
8156
+ return;
8157
+ delete section.dosu;
8127
8158
  saveJSONConfig(configPath, jsonCfg);
8128
8159
  }
8129
8160
  var import_write_file_atomic, writeFileAtomic, MCP_REMOTE_VERSION = "0.1.38";
8130
8161
  var init_config_helpers = __esm(() => {
8162
+ init_config();
8131
8163
  import_write_file_atomic = __toESM(require_lib(), 1);
8132
8164
  writeFileAtomic = import_write_file_atomic.default;
8133
8165
  });
@@ -73535,7 +73567,7 @@ var init_settings = __esm(() => {
73535
73567
  });
73536
73568
 
73537
73569
  // src/telemetry/debug-id.ts
73538
- var BUNDLE_DEBUG_ID_PLACEHOLDER = "33c6d65c-87a5-5e97-6475-6e2164756e21";
73570
+ var BUNDLE_DEBUG_ID_PLACEHOLDER = "19da2907-67f6-4221-6475-6e2164756e21";
73539
73571
 
73540
73572
  // src/telemetry/telemetry.ts
73541
73573
  import { randomUUID as randomUUID4 } from "node:crypto";
@@ -73564,11 +73596,13 @@ function normalizeContext(context) {
73564
73596
  const isAuthenticated2 = context?.isAuthenticated === true;
73565
73597
  const id2 = safeRead(context?.user, "id");
73566
73598
  const email3 = safeRead(context?.user, "email");
73567
- const user = isAuthenticated2 && validUserId(id2) ? { id: id2, ...validEmail(email3) ? { email: email3 } : {} } : undefined;
73599
+ const orgId = safeRead(context, "orgId");
73600
+ const user = isAuthenticated2 && isUUID2(id2) ? { id: id2, ...validEmail(email3) ? { email: email3 } : {} } : undefined;
73568
73601
  return {
73569
73602
  mode: context?.mode === "oss" ? "oss" : "cloud",
73570
73603
  isAuthenticated: isAuthenticated2,
73571
- ...user ? { user } : {}
73604
+ ...user ? { user } : {},
73605
+ ...user && isUUID2(orgId) ? { orgId } : {}
73572
73606
  };
73573
73607
  }
73574
73608
  function normalizeExitCode(value, fallback = 1) {
@@ -73588,12 +73622,9 @@ function normalizeRuntime(runtime) {
73588
73622
  isTty: runtime.isTty === true
73589
73623
  };
73590
73624
  }
73591
- function validInstallId(value) {
73625
+ function isUUID2(value) {
73592
73626
  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);
73593
73627
  }
73594
- function validUserId(value) {
73595
- return validInstallId(value);
73596
- }
73597
73628
  function validEmail(value) {
73598
73629
  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);
73599
73630
  }
@@ -73743,7 +73774,7 @@ function buildPostHogPayload(input2) {
73743
73774
  const result = input2.result === "success" || input2.result === "validation_error" ? input2.result : "failure";
73744
73775
  return {
73745
73776
  api_key: input2.apiKey,
73746
- distinct_id: context.user?.id ?? (validInstallId(input2.installId) ? input2.installId : FALLBACK_INSTALL_ID),
73777
+ distinct_id: context.user?.id ?? (isUUID2(input2.installId) ? input2.installId : FALLBACK_INSTALL_ID),
73747
73778
  event: "cli_command_completed",
73748
73779
  properties: {
73749
73780
  $geoip_disable: true,
@@ -73761,6 +73792,10 @@ function buildPostHogPayload(input2) {
73761
73792
  is_ci: runtime.isCi,
73762
73793
  is_tty: runtime.isTty,
73763
73794
  mode: context.mode,
73795
+ ...context.orgId ? {
73796
+ org_id: context.orgId,
73797
+ $groups: { organization: context.orgId }
73798
+ } : {},
73764
73799
  is_authenticated: context.isAuthenticated,
73765
73800
  exit_code: normalizeExitCode(input2.exitCode),
73766
73801
  ...errorCode ? { error_code: errorCode } : {}
@@ -73875,7 +73910,12 @@ function buildSentryEnvelope(input2) {
73875
73910
  level: "error",
73876
73911
  release: `dosu-cli@${runtime.version}`,
73877
73912
  tags: sentryTags(command, context, runtime, error61),
73878
- ...context.user ? { user: context.user } : {},
73913
+ ...context.user ? {
73914
+ user: {
73915
+ id: context.user.id,
73916
+ ...context.user.email ? { email: context.user.email } : {}
73917
+ }
73918
+ } : {},
73879
73919
  ...mappedBundle ? {
73880
73920
  debug_meta: {
73881
73921
  images: [{ type: "sourcemap", code_file: BUNDLE_CODE_FILE, debug_id: debugId }]
@@ -74069,7 +74109,7 @@ function safeNow(now) {
74069
74109
  function safeUuid(generate) {
74070
74110
  try {
74071
74111
  const value = generate();
74072
- return validInstallId(value) ? value : undefined;
74112
+ return isUUID2(value) ? value : undefined;
74073
74113
  } catch {
74074
74114
  return;
74075
74115
  }
@@ -74101,7 +74141,7 @@ function createCommandTelemetry(settings2, dependencies = {}) {
74101
74141
  let installIdResolved = false;
74102
74142
  let resolvedInstallId = settings2.install_id;
74103
74143
  function installId() {
74104
- if (validInstallId(resolvedInstallId))
74144
+ if (isUUID2(resolvedInstallId))
74105
74145
  return resolvedInstallId;
74106
74146
  if (installIdResolved)
74107
74147
  return;
@@ -74111,7 +74151,7 @@ function createCommandTelemetry(settings2, dependencies = {}) {
74111
74151
  } catch {
74112
74152
  resolvedInstallId = undefined;
74113
74153
  }
74114
- return validInstallId(resolvedInstallId) ? resolvedInstallId : undefined;
74154
+ return isUUID2(resolvedInstallId) ? resolvedInstallId : undefined;
74115
74155
  }
74116
74156
  function debugPayload(payload) {
74117
74157
  try {
@@ -74330,16 +74370,6 @@ var init_follow = () => {};
74330
74370
 
74331
74371
  // src/mcp/providers/base.ts
74332
74372
  function createJSONProvider(opts) {
74333
- const defaultBuildServer = (cfg) => ({
74334
- type: "http",
74335
- url: mcpURL(cfg.active_account.target.deployment_id),
74336
- headers: mcpHeaders(cfg.active_account?.target?.api_key)
74337
- });
74338
- const defaultBuildOSSServer = (cfg) => ({
74339
- type: "http",
74340
- url: mcpBaseURL(),
74341
- headers: mcpHeaders(cfg.active_account?.target?.api_key)
74342
- });
74343
74373
  const buildServer = opts.buildServer ?? defaultBuildServer;
74344
74374
  return {
74345
74375
  name: () => opts.providerName,
@@ -74351,8 +74381,10 @@ function createJSONProvider(opts) {
74351
74381
  globalConfigPath: () => expandHome(opts.globalPath),
74352
74382
  isConfigured: () => isJSONKeyConfigured(expandHome(opts.globalPath), opts.topKey),
74353
74383
  install(cfg, global2) {
74354
- if (cfg.mode !== MODE_OSS && !cfg.active_account?.target?.deployment_id)
74355
- throw new Error("deployment ID is required");
74384
+ const endpoint = {
74385
+ url: mcpEndpoint(cfg),
74386
+ headers: mcpHeaders(cfg.active_account?.target?.api_key)
74387
+ };
74356
74388
  let configPath;
74357
74389
  if (global2) {
74358
74390
  configPath = expandHome(opts.globalPath);
@@ -74361,8 +74393,7 @@ function createJSONProvider(opts) {
74361
74393
  } else {
74362
74394
  throw new Error(`${opts.providerName} does not support local installation`);
74363
74395
  }
74364
- const serverBuilder = cfg.mode === MODE_OSS ? defaultBuildOSSServer : buildServer;
74365
- installJSONServer(configPath, opts.topKey, serverBuilder(cfg));
74396
+ installJSONServer(configPath, opts.topKey, buildServer(endpoint, cfg));
74366
74397
  },
74367
74398
  remove(global2) {
74368
74399
  let configPath;
@@ -74377,8 +74408,12 @@ function createJSONProvider(opts) {
74377
74408
  }
74378
74409
  };
74379
74410
  }
74411
+ var defaultBuildServer = ({ url: url2, headers }) => ({
74412
+ type: "http",
74413
+ url: url2,
74414
+ headers
74415
+ });
74380
74416
  var init_base = __esm(() => {
74381
- init_config();
74382
74417
  init_config_helpers();
74383
74418
  init_detect();
74384
74419
  });
@@ -74392,13 +74427,12 @@ var AntigravityProvider = () => createJSONProvider({
74392
74427
  paths: ["~/.gemini"],
74393
74428
  globalPath: "~/.gemini/antigravity/mcp_config.json",
74394
74429
  topKey: "mcpServers",
74395
- buildServer: (cfg) => ({
74396
- serverUrl: mcpURL(cfg.active_account.target.deployment_id),
74397
- headers: mcpHeaders(cfg.active_account.target.api_key)
74430
+ buildServer: ({ url: url2, headers }) => ({
74431
+ serverUrl: url2,
74432
+ headers
74398
74433
  })
74399
74434
  });
74400
74435
  var init_antigravity = __esm(() => {
74401
- init_config_helpers();
74402
74436
  init_base();
74403
74437
  });
74404
74438
 
@@ -74435,9 +74469,7 @@ var ClaudeDesktopProvider = () => ({
74435
74469
  install(cfg, global2) {
74436
74470
  if (!global2)
74437
74471
  throw new Error("Claude Desktop does not support local installation");
74438
- if (cfg.mode !== MODE_OSS && !cfg.active_account?.target?.deployment_id)
74439
- throw new Error("deployment ID is required");
74440
- const url2 = cfg.mode === MODE_OSS ? mcpBaseURL() : mcpURL(cfg.active_account.target.deployment_id);
74472
+ const url2 = mcpEndpoint(cfg);
74441
74473
  const npx = findNpx();
74442
74474
  const remote = mcpRemoteServer(url2, cfg.active_account?.target?.api_key);
74443
74475
  installJSONServer(configPath(), "mcpServers", {
@@ -74453,7 +74485,6 @@ var ClaudeDesktopProvider = () => ({
74453
74485
  }
74454
74486
  });
74455
74487
  var init_claude_desktop = __esm(() => {
74456
- init_config();
74457
74488
  init_config_helpers();
74458
74489
  init_detect();
74459
74490
  });
@@ -74468,15 +74499,14 @@ var extensionDir = () => join25(appSupportDir(), "Code", "User", "globalStorage"
74468
74499
  paths: [extensionDir()],
74469
74500
  globalPath: join25(extensionDir(), "settings", "cline_mcp_settings.json"),
74470
74501
  topKey: "mcpServers",
74471
- buildServer: (cfg) => ({
74472
- url: mcpURL(cfg.active_account.target.deployment_id),
74502
+ buildServer: ({ url: url2, headers }) => ({
74503
+ url: url2,
74473
74504
  type: "streamableHttp",
74474
74505
  disabled: false,
74475
- headers: mcpHeaders(cfg.active_account.target.api_key)
74506
+ headers
74476
74507
  })
74477
74508
  });
74478
74509
  var init_cline = __esm(() => {
74479
- init_config_helpers();
74480
74510
  init_detect();
74481
74511
  init_base();
74482
74512
  });
@@ -74494,15 +74524,14 @@ var ClineCliProvider = () => createJSONProvider({
74494
74524
  paths: [clineDir()],
74495
74525
  globalPath: join26(clineDir(), "data", "settings", "cline_mcp_settings.json"),
74496
74526
  topKey: "mcpServers",
74497
- buildServer: (cfg) => ({
74498
- url: mcpURL(cfg.active_account.target.deployment_id),
74527
+ buildServer: ({ url: url2, headers }) => ({
74528
+ url: url2,
74499
74529
  type: "streamableHttp",
74500
74530
  disabled: false,
74501
- headers: mcpHeaders(cfg.active_account.target.api_key)
74531
+ headers
74502
74532
  })
74503
74533
  });
74504
74534
  var init_cline_cli = __esm(() => {
74505
- init_config_helpers();
74506
74535
  init_detect();
74507
74536
  init_base();
74508
74537
  });
@@ -74526,13 +74555,6 @@ function readTOML(path3) {
74526
74555
  function writeTOML(path3, content) {
74527
74556
  writeSecureFile(path3, content);
74528
74557
  }
74529
- function mcpEndpoint(cfg) {
74530
- if (cfg.mode === MODE_OSS)
74531
- return mcpBaseURL();
74532
- if (!cfg.active_account?.target?.deployment_id)
74533
- throw new Error("deployment ID is required");
74534
- return mcpURL(cfg.active_account?.target?.deployment_id);
74535
- }
74536
74558
  function tomlString(value) {
74537
74559
  return `"${value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
74538
74560
  }
@@ -74615,13 +74637,6 @@ function globalPath() {
74615
74637
  }
74616
74638
  return expandHome("~/.copilot/mcp-config.json");
74617
74639
  }
74618
- function mcpEndpoint2(cfg) {
74619
- if (cfg.mode === MODE_OSS)
74620
- return mcpBaseURL();
74621
- if (!cfg.active_account?.target?.deployment_id)
74622
- throw new Error("deployment ID is required");
74623
- return mcpURL(cfg.active_account?.target?.deployment_id);
74624
- }
74625
74640
  var CopilotProvider = () => ({
74626
74641
  name: () => "GitHub Copilot CLI",
74627
74642
  id: () => "copilot",
@@ -74632,7 +74647,7 @@ var CopilotProvider = () => ({
74632
74647
  globalConfigPath: () => globalPath(),
74633
74648
  isConfigured: () => isJSONKeyConfigured(globalPath(), "mcpServers"),
74634
74649
  install(cfg, global2) {
74635
- const url2 = mcpEndpoint2(cfg);
74650
+ const url2 = mcpEndpoint(cfg);
74636
74651
  if (global2) {
74637
74652
  const server = {
74638
74653
  type: "http",
@@ -74661,7 +74676,6 @@ var CopilotProvider = () => ({
74661
74676
  }
74662
74677
  });
74663
74678
  var init_copilot = __esm(() => {
74664
- init_config();
74665
74679
  init_config_helpers();
74666
74680
  init_detect();
74667
74681
  });
@@ -74676,14 +74690,13 @@ var CursorProvider = () => createJSONProvider({
74676
74690
  paths: ["~/.cursor"],
74677
74691
  globalPath: "~/.cursor/mcp.json",
74678
74692
  topKey: "mcpServers",
74679
- buildServer: (cfg) => ({
74680
- url: mcpURL(cfg.active_account.target.deployment_id),
74681
- headers: mcpHeaders(cfg.active_account.target.api_key)
74693
+ buildServer: ({ url: url2, headers }) => ({
74694
+ url: url2,
74695
+ headers
74682
74696
  }),
74683
74697
  localConfigPath: (cwd) => join29(cwd, ".cursor", "mcp.json")
74684
74698
  });
74685
74699
  var init_cursor = __esm(() => {
74686
- init_config_helpers();
74687
74700
  init_base();
74688
74701
  });
74689
74702
 
@@ -74720,13 +74733,6 @@ var init_gemini = __esm(() => {
74720
74733
  });
74721
74734
 
74722
74735
  // src/mcp/providers/manual.ts
74723
- function mcpEndpoint3(cfg) {
74724
- if (cfg.mode === MODE_OSS)
74725
- return mcpBaseURL();
74726
- if (!cfg.active_account?.target?.deployment_id)
74727
- throw new Error("deployment ID is required");
74728
- return mcpURL(cfg.active_account?.target?.deployment_id);
74729
- }
74730
74736
  function maskSecret(secret) {
74731
74737
  if (secret.length <= 8)
74732
74738
  return "[hidden]";
@@ -74738,7 +74744,7 @@ var ManualProvider = () => ({
74738
74744
  id: () => "manual",
74739
74745
  supportsLocal: () => false,
74740
74746
  install(cfg, _global, opts = {}) {
74741
- const url2 = mcpEndpoint3(cfg);
74747
+ const url2 = mcpEndpoint(cfg);
74742
74748
  const apiKey = mcpHeaders(cfg.active_account?.target?.api_key)["X-Dosu-API-Key"];
74743
74749
  const headerValue = opts.showSecret ? apiKey : maskSecret(apiKey);
74744
74750
  console.log("Use these details to configure the Dosu MCP server in your client:");
@@ -74758,7 +74764,6 @@ To remove the Dosu MCP server, manually delete the configuration from your clien
74758
74764
  }
74759
74765
  });
74760
74766
  var init_manual = __esm(() => {
74761
- init_config();
74762
74767
  init_config_helpers();
74763
74768
  });
74764
74769
 
@@ -74774,13 +74779,6 @@ function resolveGlobalConfigPath() {
74774
74779
  return jsoncPath;
74775
74780
  return jsonPath;
74776
74781
  }
74777
- function mcpEndpoint4(cfg) {
74778
- if (cfg.mode === MODE_OSS)
74779
- return mcpBaseURL();
74780
- if (!cfg.active_account?.target?.deployment_id)
74781
- throw new Error("deployment ID is required");
74782
- return mcpURL(cfg.active_account?.target?.deployment_id);
74783
- }
74784
74782
  var MCPorterProvider = () => ({
74785
74783
  name: () => "MCPorter",
74786
74784
  id: () => "mcporter",
@@ -74794,7 +74792,7 @@ var MCPorterProvider = () => ({
74794
74792
  const configPath2 = global2 ? resolveGlobalConfigPath() : join32(process.cwd(), "config", "mcporter.json");
74795
74793
  const server = {
74796
74794
  type: "http",
74797
- url: mcpEndpoint4(cfg),
74795
+ url: mcpEndpoint(cfg),
74798
74796
  headers: mcpHeaders(cfg.active_account.target.api_key)
74799
74797
  };
74800
74798
  installJSONServer(configPath2, "mcpServers", server);
@@ -74805,7 +74803,6 @@ var MCPorterProvider = () => ({
74805
74803
  }
74806
74804
  });
74807
74805
  var init_mcporter = __esm(() => {
74808
- init_config();
74809
74806
  init_config_helpers();
74810
74807
  init_detect();
74811
74808
  });
@@ -74820,16 +74817,15 @@ var OpenCodeProvider = () => createJSONProvider({
74820
74817
  paths: ["~/.config/opencode"],
74821
74818
  globalPath: "~/.config/opencode/opencode.json",
74822
74819
  topKey: "mcp",
74823
- buildServer: (cfg) => ({
74820
+ buildServer: ({ url: url2, headers }) => ({
74824
74821
  type: "remote",
74825
- url: mcpURL(cfg.active_account.target.deployment_id),
74822
+ url: url2,
74826
74823
  enabled: true,
74827
- headers: mcpHeaders(cfg.active_account.target.api_key)
74824
+ headers
74828
74825
  }),
74829
74826
  localConfigPath: (cwd) => join33(cwd, "opencode.json")
74830
74827
  });
74831
74828
  var init_opencode = __esm(() => {
74832
- init_config_helpers();
74833
74829
  init_base();
74834
74830
  });
74835
74831
 
@@ -74867,30 +74863,73 @@ var init_windsurf = __esm(() => {
74867
74863
  });
74868
74864
 
74869
74865
  // src/mcp/providers/zed.ts
74870
- import { platform as platform3 } from "node:os";
74866
+ import { rmSync as rmSync5 } from "node:fs";
74867
+ import { homedir as homedir9, platform as platform3 } from "node:os";
74871
74868
  import { join as join36 } from "node:path";
74872
74869
  function zedConfigDir() {
74873
74870
  const os3 = platform3();
74874
- if (os3 === "darwin" || os3 === "win32")
74871
+ if (os3 === "win32")
74875
74872
  return join36(appSupportDir(), "Zed");
74873
+ if (os3 === "darwin")
74874
+ return join36(homedir9(), ".config", "zed");
74876
74875
  return join36(appSupportDir(), "zed");
74877
74876
  }
74878
- var ZedProvider = () => createJSONProvider({
74879
- providerName: "Zed",
74880
- providerID: "zed",
74881
- local: true,
74882
- priorityValue: 10,
74883
- paths: [zedConfigDir()],
74884
- globalPath: join36(zedConfigDir(), "settings.json"),
74885
- topKey: "context_servers",
74886
- buildServer: (cfg) => ({
74887
- source: "custom",
74888
- type: "http",
74889
- url: mcpURL(cfg.active_account.target.deployment_id),
74890
- headers: mcpHeaders(cfg.active_account.target.api_key)
74891
- }),
74892
- localConfigPath: (cwd) => join36(cwd, ".zed", "settings.json")
74893
- });
74877
+ function zedDataDir() {
74878
+ const os3 = platform3();
74879
+ if (os3 === "darwin")
74880
+ return join36(appSupportDir(), "Zed");
74881
+ if (os3 === "win32")
74882
+ return join36(process.env.LOCALAPPDATA ?? "", "Zed");
74883
+ return join36(process.env.XDG_DATA_HOME ?? join36(homedir9(), ".local", "share"), "zed");
74884
+ }
74885
+ function legacyDarwinSettingsPath() {
74886
+ return platform3() === "darwin" ? join36(appSupportDir(), "Zed", "settings.json") : null;
74887
+ }
74888
+ function removeLegacyDosuEntry(path3) {
74889
+ let cfg;
74890
+ try {
74891
+ cfg = readJSONConfig(path3);
74892
+ } catch {
74893
+ return;
74894
+ }
74895
+ const servers = cfg.context_servers;
74896
+ if (typeof servers !== "object" || servers === null || !("dosu" in servers))
74897
+ return;
74898
+ delete servers.dosu;
74899
+ const nothingElse = Object.keys(cfg).length === 1 && Object.keys(servers).length === 0;
74900
+ if (nothingElse)
74901
+ rmSync5(path3, { force: true });
74902
+ else
74903
+ saveJSONConfig(path3, cfg);
74904
+ }
74905
+ var ZedProvider = (legacyPath = legacyDarwinSettingsPath()) => {
74906
+ const provider = createJSONProvider({
74907
+ providerName: "Zed",
74908
+ providerID: "zed",
74909
+ local: true,
74910
+ priorityValue: 10,
74911
+ paths: [zedConfigDir(), zedDataDir()],
74912
+ globalPath: join36(zedConfigDir(), "settings.json"),
74913
+ topKey: "context_servers",
74914
+ buildServer: ({ url: url2, headers }) => ({ url: url2, headers }),
74915
+ localConfigPath: (cwd) => join36(cwd, ".zed", "settings.json")
74916
+ });
74917
+ if (!legacyPath)
74918
+ return provider;
74919
+ return {
74920
+ ...provider,
74921
+ install(cfg, global2) {
74922
+ provider.install(cfg, global2);
74923
+ if (global2)
74924
+ removeLegacyDosuEntry(legacyPath);
74925
+ },
74926
+ remove(global2) {
74927
+ provider.remove(global2);
74928
+ if (global2)
74929
+ removeLegacyDosuEntry(legacyPath);
74930
+ }
74931
+ };
74932
+ };
74894
74933
  var init_zed = __esm(() => {
74895
74934
  init_config_helpers();
74896
74935
  init_detect();
@@ -75104,13 +75143,13 @@ var init_update_check = __esm(() => {
75104
75143
 
75105
75144
  // src/rules/installer.ts
75106
75145
  import { existsSync as existsSync23, mkdirSync as mkdirSync13, readFileSync as readFileSync22, unlinkSync as unlinkSync4, writeFileSync as writeFileSync14 } from "node:fs";
75107
- import { homedir as homedir9 } from "node:os";
75146
+ import { homedir as homedir10 } from "node:os";
75108
75147
  import { dirname as dirname9, join as join38 } from "node:path";
75109
75148
  function claudeConfigDir() {
75110
- return process.env.CLAUDE_CONFIG_DIR || join38(homedir9(), ".claude");
75149
+ return process.env.CLAUDE_CONFIG_DIR || join38(homedir10(), ".claude");
75111
75150
  }
75112
75151
  function codexHome3() {
75113
- return process.env.CODEX_HOME || join38(homedir9(), ".codex");
75152
+ return process.env.CODEX_HOME || join38(homedir10(), ".codex");
75114
75153
  }
75115
75154
  function isRuleAgent(agent) {
75116
75155
  return Object.hasOwn(RULE_TARGETS, agent);
@@ -75256,7 +75295,7 @@ var init_installer = __esm(() => {
75256
75295
  },
75257
75296
  cursor: {
75258
75297
  kind: "file",
75259
- path: () => join38(homedir9(), ".cursor", "rules", "dosu.mdc"),
75298
+ path: () => join38(homedir10(), ".cursor", "rules", "dosu.mdc"),
75260
75299
  cursorFrontmatter: true
75261
75300
  },
75262
75301
  codex: {
@@ -75265,15 +75304,15 @@ var init_installer = __esm(() => {
75265
75304
  },
75266
75305
  opencode: {
75267
75306
  kind: "section",
75268
- path: () => join38(homedir9(), ".config", "opencode", "AGENTS.md")
75307
+ path: () => join38(homedir10(), ".config", "opencode", "AGENTS.md")
75269
75308
  },
75270
75309
  gemini: {
75271
75310
  kind: "section",
75272
- path: () => join38(homedir9(), ".gemini", "GEMINI.md")
75311
+ path: () => join38(homedir10(), ".gemini", "GEMINI.md")
75273
75312
  },
75274
75313
  antigravity: {
75275
75314
  kind: "section",
75276
- path: () => join38(homedir9(), ".gemini", "GEMINI.md")
75315
+ path: () => join38(homedir10(), ".gemini", "GEMINI.md")
75277
75316
  }
75278
75317
  };
75279
75318
  });
@@ -75413,7 +75452,7 @@ var MCP_PROVIDER_SLUG2 = "dosu_mcp";
75413
75452
 
75414
75453
  // src/sessions/session-title.ts
75415
75454
  import { existsSync as existsSync25, mkdirSync as mkdirSync14, readFileSync as readFileSync24, renameSync as renameSync6, statSync as statSync9, writeFileSync as writeFileSync16 } from "node:fs";
75416
- import { homedir as homedir10 } from "node:os";
75455
+ import { homedir as homedir11 } from "node:os";
75417
75456
  import { join as join40 } from "node:path";
75418
75457
  function cachePath2(configDir) {
75419
75458
  return join40(configDir, CACHE_FILENAME5);
@@ -75468,7 +75507,7 @@ function claudeSummaryFromHead(text) {
75468
75507
  }
75469
75508
  return null;
75470
75509
  }
75471
- function reconstructSession(harness, id2, slug, home = homedir10(), exists = existsSync25) {
75510
+ function reconstructSession(harness, id2, slug, home = homedir11(), exists = existsSync25) {
75472
75511
  if (!slug)
75473
75512
  return null;
75474
75513
  const candidates = [];
@@ -76135,7 +76174,7 @@ async function trackCliOnboardingEvent(cfg, onboardingRunID, event, properties =
76135
76174
  return;
76136
76175
  if (!cfg.active_account?.session.access_token)
76137
76176
  return;
76138
- if (!isUUID2(onboardingRunID))
76177
+ if (!isUUID3(onboardingRunID))
76139
76178
  return;
76140
76179
  const input2 = {
76141
76180
  event,
@@ -76158,7 +76197,7 @@ async function trackCliOnboardingPreAuthEvent(onboardingRunID, event, properties
76158
76197
  return;
76159
76198
  if (!analyticsReleaseEnabled())
76160
76199
  return;
76161
- if (!isUUID2(onboardingRunID))
76200
+ if (!isUUID3(onboardingRunID))
76162
76201
  return;
76163
76202
  const input2 = {
76164
76203
  event,
@@ -76191,13 +76230,14 @@ function analyticsReleaseEnabled() {
76191
76230
  return Boolean(parsePostHogProjectToken(process.env.DOSU_POSTHOG_PROJECT_TOKEN_OVERRIDE ?? "phc_Uo9RxhN0HRk8gZkPlT18BCr7eqsM0MPWVW88HZB95V5"));
76192
76231
  }
76193
76232
  function baseProperties(cfg) {
76233
+ const orgId = cfg.active_account?.target?.org_id;
76194
76234
  return {
76195
76235
  cli_version: safeIdentifier(VERSION, 32),
76196
76236
  install_channel: safeIdentifier(INSTALL_CHANNEL, 32),
76197
76237
  platform: safeIdentifier(process.platform, 24),
76198
76238
  arch: safeIdentifier(process.arch, 24),
76199
76239
  mode: cfg.mode ?? "cloud",
76200
- org_id: safeIdentifier(cfg.active_account?.target?.org_id, 128),
76240
+ ...orgId && isUUID3(orgId) ? { org_id: orgId, $groups: { organization: orgId } } : {},
76201
76241
  deployment_id: safeIdentifier(cfg.active_account?.target?.deployment_id, 128),
76202
76242
  space_id: safeIdentifier(cfg.active_account?.target?.space_id, 128)
76203
76243
  };
@@ -76232,7 +76272,7 @@ function allowlistedWorkflowProperties(properties) {
76232
76272
  function safeIdentifier(value, maxLength) {
76233
76273
  return typeof value === "string" && value.length <= maxLength && /^[A-Za-z0-9][A-Za-z0-9._+-]*$/.test(value) ? value : undefined;
76234
76274
  }
76235
- function isUUID2(value) {
76275
+ function isUUID3(value) {
76236
76276
  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);
76237
76277
  }
76238
76278
  function createAnalyticsClient(accessToken, requestSignal) {
@@ -78430,7 +78470,7 @@ __export(exports_tui, {
78430
78470
  runTUI: () => runTUI,
78431
78471
  handleLogout: () => handleLogout
78432
78472
  });
78433
- import { homedir as homedir11 } from "node:os";
78473
+ import { homedir as homedir12 } from "node:os";
78434
78474
  import { basename as basename6 } from "node:path";
78435
78475
  async function probeSession(cfg) {
78436
78476
  if (!isAuthenticated(cfg) || !isTokenExpired(cfg))
@@ -78695,7 +78735,7 @@ async function runSettings(cfg) {
78695
78735
  }
78696
78736
  }
78697
78737
  function displayDir(dir) {
78698
- const home = homedir11();
78738
+ const home = homedir12();
78699
78739
  return dir === home ? "~" : dir.startsWith(`${home}/`) ? `~${dir.slice(home.length)}` : dir;
78700
78740
  }
78701
78741
  function discoverProjectDirs() {
@@ -84405,10 +84445,12 @@ function commandTelemetryContext() {
84405
84445
  const tokenUserID = getAccessTokenUserID(accessToken);
84406
84446
  const userID = configUserID && configUserID === tokenUserID ? configUserID : undefined;
84407
84447
  const email3 = userID ? getAccessTokenEmail(accessToken) : undefined;
84448
+ const orgId = userID ? cfg.active_account?.target?.org_id : undefined;
84408
84449
  return {
84409
84450
  mode: cfg.mode === MODE_OSS ? "oss" : "cloud",
84410
84451
  isAuthenticated: authenticated,
84411
- ...userID ? { user: { id: userID, ...email3 ? { email: email3 } : {} } } : {}
84452
+ ...userID ? { user: { id: userID, ...email3 ? { email: email3 } : {} } } : {},
84453
+ ...orgId ? { orgId } : {}
84412
84454
  };
84413
84455
  } catch {
84414
84456
  return { mode: "cloud", isAuthenticated: false };
@@ -84894,4 +84936,4 @@ execute().catch((err) => {
84894
84936
  process.exit(1);
84895
84937
  });
84896
84938
 
84897
- //# debugId=33c6d65c-87a5-5e97-6475-6e2164756e21
84939
+ //# debugId=19da2907-67f6-4221-6475-6e2164756e21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosu/cli",
3
- "version": "0.53.0-beta.15",
3
+ "version": "0.53.0-beta.16",
4
4
  "type": "module",
5
5
  "description": "Dosu CLI - Manage MCP servers for AI tools",
6
6
  "license": "MIT",