Skip to content

Commit 30bfa65

Browse files
committed
feat: add PostHog telemetry provider for cloud builds
- Add posthog-js dependency - Create PostHogTelemetryProvider following MixpanelTelemetryProvider pattern - Register provider in initTelemetry.ts - Read posthog_project_token and posthog_api_host from window.__CONFIG__ (runtime config from /features endpoint) - Add PostHog to dist telemetry scan and license exclusion - Tree-shaken away in OSS builds (verified)
1 parent fe8ab1d commit 30bfa65

10 files changed

Lines changed: 859 additions & 68 deletions

File tree

.github/workflows/ci-dist-telemetry-scan.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,22 @@ jobs:
7979
exit 1
8080
fi
8181
echo '✅ No Mixpanel references found'
82+
83+
- name: Scan dist for PostHog telemetry references
84+
run: |
85+
set -euo pipefail
86+
echo '🔍 Scanning for PostHog references...'
87+
if rg --no-ignore -n \
88+
-g '*.html' \
89+
-g '*.js' \
90+
-e '(?i)posthog\.init' \
91+
-e '(?i)posthog\.capture' \
92+
-e 'PostHogTelemetryProvider' \
93+
-e 'ph\.comfy\.org' \
94+
-e 'posthog-js' \
95+
dist; then
96+
echo '❌ ERROR: PostHog references found in dist assets!'
97+
echo 'PostHog must be properly tree-shaken from OSS builds.'
98+
exit 1
99+
fi
100+
echo '✅ No PostHog references found'

.github/workflows/ci-oss-assets-validation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
if npx license-checker-rseidelsohn@4 \
100100
--production \
101101
--summary \
102-
--excludePackages '@comfyorg/comfyui-frontend;@comfyorg/design-system;@comfyorg/registry-types;@comfyorg/shared-frontend-utils;@comfyorg/tailwind-utils;@comfyorg/comfyui-electron-types' \
102+
--excludePackages '@comfyorg/comfyui-frontend;@comfyorg/design-system;@comfyorg/registry-types;@comfyorg/shared-frontend-utils;@comfyorg/tailwind-utils;@comfyorg/comfyui-electron-types;posthog-js' \
103103
--onlyAllow 'MIT;MIT*;Apache-2.0;BSD-2-Clause;BSD-3-Clause;ISC;0BSD;BlueOak-1.0.0;Python-2.0;CC0-1.0;Unlicense;(MIT OR Apache-2.0);(MIT OR GPL-3.0);(Apache-2.0 OR MIT);(MPL-2.0 OR Apache-2.0);CC-BY-4.0;CC-BY-3.0;GPL-3.0-only'; then
104104
echo ''
105105
echo '✅ All production dependency licenses are approved!'

global.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ interface Window {
3333
gtm_container_id?: string
3434
ga_measurement_id?: string
3535
mixpanel_token?: string
36+
posthog_project_token?: string
37+
posthog_api_host?: string
3638
require_whitelist?: boolean
3739
subscription_required?: boolean
3840
max_upload_size?: number

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
"loglevel": "^1.9.2",
101101
"marked": "^15.0.11",
102102
"pinia": "catalog:",
103+
"posthog-js": "catalog:",
103104
"primeicons": "catalog:",
104105
"primevue": "catalog:",
105106
"reka-ui": "catalog:",

0 commit comments

Comments
 (0)