mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-17 03:10:38 +09:00
feat: implement app-side telemetry sender
Add the shared telemetry sender, wire the CLI/server emit points, and cover the config and completion behavior with tests. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
ca5659f734
commit
34044cdfce
29 changed files with 670 additions and 5 deletions
25
packages/shared/src/telemetry/config.ts
Normal file
25
packages/shared/src/telemetry/config.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import type { TelemetryConfig } from "./types.js";
|
||||
|
||||
const CI_ENV_VARS = ["CI", "CONTINUOUS_INTEGRATION", "BUILD_NUMBER", "GITHUB_ACTIONS", "GITLAB_CI"];
|
||||
|
||||
function isCI(): boolean {
|
||||
return CI_ENV_VARS.some((key) => process.env[key] === "true" || process.env[key] === "1");
|
||||
}
|
||||
|
||||
export function resolveTelemetryConfig(fileConfig?: { enabled?: boolean }): TelemetryConfig {
|
||||
if (process.env.PAPERCLIP_TELEMETRY_DISABLED === "1") {
|
||||
return { enabled: false };
|
||||
}
|
||||
if (process.env.DO_NOT_TRACK === "1") {
|
||||
return { enabled: false };
|
||||
}
|
||||
if (isCI()) {
|
||||
return { enabled: false };
|
||||
}
|
||||
if (fileConfig?.enabled === false) {
|
||||
return { enabled: false };
|
||||
}
|
||||
|
||||
const endpoint = process.env.PAPERCLIP_TELEMETRY_ENDPOINT || undefined;
|
||||
return { enabled: true, endpoint };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue