From c99ec92440835d78311815a5c73236c14c6b9726 Mon Sep 17 00:00:00 2001 From: Jacob Heider Date: Thu, 13 Aug 2026 11:09:48 -0400 Subject: [PATCH] fix(mongosh) closes #14067 --- projects/mongodb.com/shell/package.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/projects/mongodb.com/shell/package.yml b/projects/mongodb.com/shell/package.yml index 50c5be99ae..ff2f5848fb 100644 --- a/projects/mongodb.com/shell/package.yml +++ b/projects/mongodb.com/shell/package.yml @@ -18,13 +18,24 @@ build: - npm i $ARGS - run: ln -s ../libexec/bin/mongosh mongosh working-directory: "{{prefix}}/bin" + # 2.10.0: unpublished getAiAgent (container TypeError) + no telemetry ids + - run: sed -i -f $PROP cli-repl.js + working-directory: ${{prefix}}/libexec/lib/node_modules/@mongosh/cli-repl/lib + if: ">=2.10.0" + prop: | + s/!(0, logging_2.getAiAgent)()/!(typeof logging_2.getAiAgent === "function" \&\& logging_2.getAiAgent())/ + /completed telemetry setup/a\\ + {\\ + const id = this.config.userId || this.config.telemetryAnonymousId || new bson_1.ObjectId().toHexString();\\ + this.config.userId ||= id;\\ + this.config.telemetryAnonymousId ||= id;\\ + this.bus.emit('mongosh:new-user', { userId: this.config.userId, anonymousId: this.config.telemetryAnonymousId });\\ + } env: ARGS: - - -ddd + - --ddd - --global - - --build-from-source - --prefix={{prefix}}/libexec - - --unsafe-perm - cli-repl-{{version}}.tgz provides: