note whether headless mode / github actions in telemetry
This commit is contained in:
parent
1679ebb8f0
commit
2931a93a0c
1 changed files with 13 additions and 1 deletions
|
|
@ -4,7 +4,9 @@ import node_machine_id from "node-machine-id";
|
|||
import type { PostHog as PostHogType } from "posthog-node";
|
||||
|
||||
import { isAuthenticatedConfig, loadAuthConfig } from "../auth/workos.js";
|
||||
import { isGitHubActions } from "../util/git.js";
|
||||
import { logger } from "../util/logger.js";
|
||||
import { getVersion } from "../version.js";
|
||||
|
||||
export class PosthogService {
|
||||
private os: string | undefined;
|
||||
|
|
@ -15,6 +17,14 @@ export class PosthogService {
|
|||
this.uniqueId = this.getEventUserId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if running in headless mode (-p flag)
|
||||
*/
|
||||
private isHeadlessMode(): boolean {
|
||||
const args = process.argv.slice(2);
|
||||
return args.includes("-p") || args.includes("--print");
|
||||
}
|
||||
|
||||
get isEnabled() {
|
||||
return process.env.CONTINUE_CLI_ENABLE_TELEMETRY !== "0";
|
||||
}
|
||||
|
|
@ -62,9 +72,11 @@ export class PosthogService {
|
|||
const augmentedProperties = {
|
||||
...properties,
|
||||
os: this.os,
|
||||
extensionVersion: "", // TODO cn version
|
||||
extensionVersion: getVersion(),
|
||||
ideName: "cn",
|
||||
ideType: "cli",
|
||||
isHeadless: this.isHeadlessMode(),
|
||||
isGitHubCI: isGitHubActions(),
|
||||
};
|
||||
const payload = {
|
||||
distinctId: this.uniqueId,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue