Skip to content

"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/

Python

feat(analytics): route footer PostHog query through Cloudflare Worker proxy, bump cli-hub to 0.2.2

yuhao0a047cb8bce1
diff --git a/cli-hub/cli_hub/__init__.py b/cli-hub/cli_hub/__init__.py
index ccb2cf165..f9ad4ed0e 100644
--- a/cli-hub/cli_hub/__init__.py
+++ b/cli-hub/cli_hub/__init__.py
@@ -1,3 +1,3 @@
"""cli-hub — Download, manage, and browse CLI-Anything harnesses."""
-__version__ = "0.2.1"
+__version__ = "0.2.2"
diff --git a/cli-hub/setup.py b/cli-hub/setup.py
index 9b412cc3c..eda0b779d 100644
--- a/cli-hub/setup.py
+++ b/cli-hub/setup.py
@@ -4,7 +4,7 @@ from setuptools import setup, find_packages
setup(
name="cli-anything-hub",
- version="0.2.1",
+ version="0.2.2",
description="Package manager for CLI-Anything — browse, install, and manage 40+ agent-native CLI interfaces for GUI applications",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
diff --git a/docs/hub/index-modern.html b/docs/hub/index-modern.html
index f609c8446..704ff3778 100644
--- a/docs/hub/index-modern.html
+++ b/docs/hub/index-modern.html
@@ -2909,19 +2909,15 @@
document.addEventListener(evt, onHumanInteraction, { once: false, passive: true });
});
- // ── Live analytics (PostHog HogQL) ──
- // Read-only personal API key, scoped to `query:read` on project 393992 only.
- // See https://us.posthog.com/settings/user-api-keys.
- const POSTHOG_READONLY_KEY = 'phx_FizBjpYkycqd7b9UC2ZebHNhze6gn8T9SmUv5uG8dXXLepHj';
- const POSTHOG_QUERY_HOST = 'https://us.posthog.com';
- const POSTHOG_QUERY_PROJECT_ID = '393992';
+ // ── Live analytics (PostHog HogQL via Cloudflare Worker proxy) ──
+ // PostHog key lives in a Cloudflare Worker secret (repo:
+ // ~/clianything-analytics-worker). The worker allow-lists this exact
+ // HogQL shape and forwards to us.posthog.com.
+ const ANALYTICS_PROXY_URL = 'https://analytics.clianything.cc/';
const MIGRATION_STARTED_AT = '2026-04-23T09:06:38Z';
const LIVE_STATS_REFRESH_MS = 60_000;
async function fetchPosthogIncrement() {
- if (!POSTHOG_READONLY_KEY || POSTHOG_READONLY_KEY.indexOf('REPLACE') !== -1) {
- throw new Error('posthog readonly key not configured');
- }
const hogql = (
"select " +
"countIf(event = 'visit-human' and properties.source = 'web' and properties.site = 'clianything.cc') as human, " +
@@ -2931,12 +2927,9 @@
"from events " +
"where timestamp >= parseDateTimeBestEffort('" + MIGRATION_STARTED_AT + "')"
);
- const response = await fetch(POSTHOG_QUERY_HOST + '/api/projects/' + POSTHOG_QUERY_PROJECT_ID + '/query/', {
+ const response = await fetch(ANALYTICS_PROXY_URL, {
method: 'POST',
- headers: {
- 'Authorization': 'Bearer ' + POSTHOG_READONLY_KEY,
- 'Content-Type': 'application/json',
- },
+ headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query: { kind: 'HogQLQuery', query: hogql } }),
});
if (!response.ok) throw new Error('posthog query http ' + response.status);
diff --git a/docs/hub/index.html b/docs/hub/index.html
index 3baa8027f..9d687feea 100644
--- a/docs/hub/index.html
+++ b/docs/hub/index.html
@@ -3123,21 +3123,17 @@
document.addEventListener(evt, onHumanInteraction, { once: false, passive: true });
});
- // ── Live analytics (PostHog HogQL) ──
- // Read-only personal API key, scoped to `query:read` on project 393992 only.
- // See https://us.posthog.com/settings/user-api-keys — create a scoped key
- // and paste it below. The Umami baseline is fixed at the migration cutover
- // and PostHog counts are added on top of it.
- const POSTHOG_READONLY_KEY = 'phx_FizBjpYkycqd7b9UC2ZebHNhze6gn8T9SmUv5uG8dXXLepHj';
- const POSTHOG_QUERY_HOST = 'https://us.posthog.com';
- const POSTHOG_QUERY_PROJECT_ID = '393992';
+ // ── Live analytics (PostHog HogQL via Cloudflare Worker proxy) ──
+ // The PostHog personal API key lives in a Cloudflare Worker secret
+ // (repo: ~/clianything-analytics-worker). The worker allow-lists this
+ // exact HogQL shape and forwards to us.posthog.com. The baseline
+ // BASELINE_STATS is the Umami total at migration cutover; live PostHog
+ // counts since then are added on top.
+ const ANALYTICS_PROXY_URL = 'https://analytics.clianything.cc/';
const MIGRATION_STARTED_AT = '2026-04-23T09:06:38Z';
const LIVE_STATS_REFRESH_MS = 60_000;
async function fetchPosthogIncrement() {
- if (!POSTHOG_READONLY_KEY || POSTHOG_READONLY_KEY.indexOf('REPLACE') !== -1) {
- throw new Error('posthog readonly key not configured');
- }
const hogql = (
"select " +
"countIf(event = 'visit-human' and properties.source = 'web' and properties.site = 'clianything.cc') as human, " +
@@ -3147,12 +3143,9 @@
"from events " +
"where timestamp >= parseDateTimeBestEffort('" + MIGRATION_STARTED_AT + "')"
);
- const response = await fetch(POSTHOG_QUERY_HOST + '/api/projects/' + POSTHOG_QUERY_PROJECT_ID + '/query/', {
+ const response = await fetch(ANALYTICS_PROXY_URL, {
method: 'POST',
- headers: {
- 'Authorization': 'Bearer ' + POSTHOG_READONLY_KEY,
- 'Content-Type': 'application/json',
- },
+ headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query: { kind: 'HogQLQuery', query: hogql } }),
});
if (!response.ok) throw new Error('posthog query http ' + response.status);