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:
dotta 2026-03-31 08:08:18 -05:00
parent ca5659f734
commit 34044cdfce
29 changed files with 670 additions and 5 deletions

View file

@ -12,6 +12,8 @@ import type {
CompanyPortabilityPreviewResult,
CompanyPortabilityImportResult,
} from "@paperclipai/shared";
import { trackCompanyImported } from "@paperclipai/shared/telemetry";
import { getTelemetryClient } from "../../telemetry.js";
import { ApiRequestError } from "../../client/http.js";
import { openUrl } from "../../client/board-auth.js";
import { binaryContentTypeByExtension, readZipArchive } from "./zip.js";
@ -1440,6 +1442,12 @@ export function registerCompanyCommands(program: Command): void {
if (!imported) {
throw new Error("Import request returned no data.");
}
const tc = getTelemetryClient();
if (tc) {
const isPrivate = sourcePayload.type !== "github";
const sourceRef = sourcePayload.type === "github" ? sourcePayload.url : from;
trackCompanyImported(tc, { sourceType: sourcePayload.type, sourceRef, isPrivate });
}
let companyUrl: string | undefined;
if (!ctx.json) {
try {