* 🎨 refactor out react context * 🎨 refactor local storage * 🎨 refactor IdeMessenger * 🔥 removing unused files * 🚚 move scripts * ✅ setup VSCode integration testing * 🎨 fix test-related stuff * 🚧 testing * 🎨 tweak terminal cmd+L * 🧑💻 install biome in core * 🎨 run biome check on core * 🎨 run biome check in vscode * 🎨 run biome check in binary * 🧑💻 global biome config * 🎨 run biome check on core * 🎨 run biome check in vscode * 🎨 fix a few biome warnings * 🚧 WIP on protocols * 🚧 progress, organizing, about to remove webviewCore protocol * 🚧 now running * 🚧 move indexing code to core * 🚧 WIP on JetBrains indexing implementation * 🎨 finish listDir * 🚧 gui fixes * 🏷️ update IMessenger.on return type * 🐛 fix jetbrains types + IDE detection * 🧑💻 set up debugging for binary with TcpMessenger * 👷 fix prepackage.js * 🧑💻 turn off debug mode for intellij * 🐛 merge fixes * 🐛 fixes after refactor * 🐛 merge fixes * 💄 increase font size in JB * 🔀 merge changes * 🩹 small fixes * 🐛 fix jetbrains build * 🩹 more jetbrains fixes * 🎨 jetbrains improvements * 🐛 fix lancedb prob in jetbrains build * 👷 update jetbrains build process * ✨ intellij problems context provider * 👷 add script utils file * 💚 fix jetbrains build regression * 🎨 dynamic import transformers.js * 🩹 small jetbrains updates * ✨ folder context provider in jetbrains * 🎨 many more jetbrains improvements * 🔀 merge fixes * ⚡️ small improvements * 🎨 tell users transformers.js not supported * 🎨 trial updates * 📝 update jetbrains readmej * ⚡️ only use smaller context for local autocomplete models * ⚡️ improve bracket filter * ✨ global .continue/.prompts folder * 💄 improved model setup process * 🥅 display VSCode req errs
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import os from "node:os";
|
|
|
|
export class Telemetry {
|
|
// Set to undefined whenever telemetry is disabled
|
|
static client: any = undefined;
|
|
static uniqueId = "NOT_UNIQUE";
|
|
static os: string | undefined = undefined;
|
|
static extensionVersion: string | undefined = undefined;
|
|
|
|
static async capture(event: string, properties: { [key: string]: any }) {
|
|
Telemetry.client?.capture({
|
|
distinctId: Telemetry.uniqueId,
|
|
event,
|
|
properties: {
|
|
...properties,
|
|
os: Telemetry.os,
|
|
extensionVersion: Telemetry.extensionVersion,
|
|
},
|
|
});
|
|
}
|
|
|
|
static shutdownPosthogClient() {
|
|
Telemetry.client?.shutdown();
|
|
}
|
|
|
|
static async setup(
|
|
allow: boolean,
|
|
uniqueId: string,
|
|
extensionVersion: string,
|
|
) {
|
|
Telemetry.uniqueId = uniqueId;
|
|
Telemetry.os = os.platform();
|
|
Telemetry.extensionVersion = extensionVersion;
|
|
|
|
if (!allow) {
|
|
Telemetry.client = undefined;
|
|
} else {
|
|
try {
|
|
if (!Telemetry.client) {
|
|
const { PostHog } = await import("posthog-node");
|
|
Telemetry.client = new PostHog(
|
|
"phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs",
|
|
{
|
|
host: "https://app.posthog.com",
|
|
},
|
|
);
|
|
}
|
|
} catch (e) {
|
|
console.error(`Failed to setup telemetry: ${e}`);
|
|
}
|
|
}
|
|
}
|
|
}
|