summaryrefslogtreecommitdiff
path: root/scripts/telemetry_utils.js
diff options
context:
space:
mode:
authorLouis Jimenez <[email protected]>2025-06-19 21:09:05 -0400
committerGitHub <[email protected]>2025-06-19 21:09:05 -0400
commit2e5e9d736b48522444834659a125c5adc1a15686 (patch)
treec65943b689c97b3ff90f11fa6fc7e45458c3c372 /scripts/telemetry_utils.js
parent04518b52c0ddcd5ae1192763c55e472add218b3c (diff)
Move the otel folder out of project root .gemini and into user home dir (#1188)
Diffstat (limited to 'scripts/telemetry_utils.js')
-rw-r--r--scripts/telemetry_utils.js24
1 files changed, 20 insertions, 4 deletions
diff --git a/scripts/telemetry_utils.js b/scripts/telemetry_utils.js
index 05f607a2..a37c6fd1 100644
--- a/scripts/telemetry_utils.js
+++ b/scripts/telemetry_utils.js
@@ -12,15 +12,31 @@ import net from 'net';
import os from 'os';
import { execSync } from 'child_process';
import { fileURLToPath } from 'url';
+import crypto from 'node:crypto';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
-export const ROOT_DIR = path.resolve(__dirname, '..');
-export const GEMINI_DIR = path.join(ROOT_DIR, '.gemini');
-export const OTEL_DIR = path.join(GEMINI_DIR, 'otel');
+const projectRoot = path.resolve(__dirname, '..');
+const projectHash = crypto
+ .createHash('sha256')
+ .update(projectRoot)
+ .digest('hex');
+
+// User-level .gemini directory in home
+const USER_GEMINI_DIR = path.join(os.homedir(), '.gemini');
+// Project-level .gemini directory in the workspace
+const WORKSPACE_GEMINI_DIR = path.join(projectRoot, '.gemini');
+
+// Telemetry artifacts are stored in a hashed directory under the user's ~/.gemini/tmp
+export const OTEL_DIR = path.join(USER_GEMINI_DIR, 'tmp', projectHash, 'otel');
export const BIN_DIR = path.join(OTEL_DIR, 'bin');
-export const WORKSPACE_SETTINGS_FILE = path.join(GEMINI_DIR, 'settings.json');
+
+// Workspace settings remain in the project's .gemini directory
+export const WORKSPACE_SETTINGS_FILE = path.join(
+ WORKSPACE_GEMINI_DIR,
+ 'settings.json',
+);
export function getJson(url) {
const tmpFile = path.join(