Sitelet https://github.com/NodeOps-app/treg2/commit/840a288891e132e63c2f07489b99ac4c502238a3
Skip to content

Commit 840a288

Browse files
authored
feat(cli): release 0.18.0 with anonymous PostHog telemetry (superdesigndev#412)
* feat(cli): add anonymous PostHog usage telemetry * fix(ci): recognize public PostHog ingestion token * fix(ci): match ingestion token in historical diff lines * release: 0.18.0 * fix(cli): allow cold SDK imports within telemetry exit budget
1 parent 64b49d0 commit 840a288

21 files changed

Lines changed: 322 additions & 15 deletions

File tree

‎.agents/skills/tools-registry-context/MAP.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ Regenerate via `scripts/build-map.py`.
189189
| `src/treg/catalog/tomba.yaml` | architecture/catalog.md, architecture/money.md |
190190
| `src/treg/catalog/trykitt.yaml` | architecture/catalog.md |
191191
| `src/treg/cli.py` | architecture/instagram-oauth.md, interface/cli.md, interface/onboarding.md, interface/shell.md |
192+
| `src/treg/cli_analytics.py` | interface/cli.md |
192193
| `src/treg/client_identity.py` | architecture/import-boundaries.md, architecture/proxy-model.md, interface/api.md |
193194
| `src/treg/config.py` | architecture/auth-secrets.md, architecture/feedback.md, architecture/super-admin.md, guides/expanding-a-category.md, ops/deploy.md |
194195
| `src/treg/convert.py` | interface/cli.md |
@@ -388,7 +389,7 @@ Regenerate via `scripts/build-map.py`.
388389
| `guides/expanding-a-category.md` | `oauth_providers.py`, `authorization.py`, `oauth_flow.py`, `oauth_exchange.py`, `connect.py`, `connections.py`, `config.py` |
389390
| `interface/api.md` | `sitetrack.js`, `api.py`, `bootstrap_handlers.py`, `bootstrap_http.py`, `call_surface.py`, `caller_metadata.py`, `client_identity.py`, `auth.py`, `access.py`, `authorize.py`, `idempotency.py`, `intake.py`, `resolve.py`, `reserve.py`, `settle.py`, `evidence.py`, `service.py`, `types.py`, `relay.py`, `connect.py`, `onboard.py`, `referrals.py`, `signup.py`, `__init__.py`, `admin.py`, `auth.py`, `auth_helpers.py`, `billing.py`, `call.py`, `catalog.py`, `connections.py`, `onboard.py`, `orgs.py`, `resources.py`, `referrals.py`, `signup_cookies.py`, `web.py`, `access.py`, `teams.py`, `access.py`, `budgets.py`, `publicdemo.py`, `usage.py`, `mcp_oauth.py`, `session.py`, `timeutil.py`, `store.py`, `email.py`, `runner.py`, `ratestore.py` |
390391
| `interface/catalog-review-proposal.md` | `store.py`, `capabilities.yaml` |
391-
| `interface/cli.md` | `cli.py`, `convert.py`, `agents.py` |
392+
| `interface/cli.md` | `cli.py`, `cli_analytics.py`, `convert.py`, `agents.py` |
392393
| `interface/dashboard.md` | `sitetrack.js`, `index.html`, `README.md`, `vue-3.5.41.global.prod.js`, `tutorial.js`, `tutorial.html`, `tour.js`, `index.html`, `api.py`, `web.py`, `session.py` |
393394
| `interface/env-import.md` | `providers.py`, `skills.py` |
394395
| `interface/landing-sandbox.md` | `sandbox.py`, `sandbox_identity.py`, `pubfeed.py`, `sandbox.py`, `__init__.py`, `sandbox.py`, `api.py`, `onboard.py`, `web.py`, `index.html`, `install.sh` |

‎.claude-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
33
"name": "treg",
44
"displayName": "treg",
5-
"version": "0.17.0",
5+
"version": "0.18.0",
66
"description": "OpenRouter for tools - 2,896 agent-friendly tools, pay for the usage, not subscription",
77
"author": {
88
"name": "Superdesign dev, Inc.",

‎.cursor-plugin/marketplace.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"metadata": {
88
"description": "OpenRouter for tools - 2,896 agent-friendly tools, pay for the usage, not subscription",
9-
"version": "0.17.0"
9+
"version": "0.18.0"
1010
},
1111
"plugins": [
1212
{

‎.gitleaks.toml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ paths = ['''src/treg/catalog/examples/.*\.json''']
4949
# it authorises nothing but "submit URLs for this host". Matched by the line, not the value, so a
5050
# real credential on the same line shape elsewhere still fires.
5151
regexTarget = "line"
52-
regexes = ['''INDEXNOW_KEY\s*=|#\s*must match INDEX''']
52+
regexes = [
53+
'''INDEXNOW_KEY\s*=|#\s*must match INDEX''',
54+
# Public PostHog ingestion token from https://treg.to/meta, not a personal API key.
55+
# Match this exact assignment only; other PostHog keys still trigger the scanner.
56+
'''POSTHOG_KEY = "phc_sAgf5A7TPRRA6faCzuqGVUo8pyb3x5Nq7TJYfn6ZVif9"''',
57+
]
5358
# (An allowlist entry for a real dev/e2e Fernet key lived here as a stopgap while
5459
# `feat/error-capture` carried it in `e2e-server.sh`. That branch now generates a fresh key per run
5560
# — the harness deletes its database between runs, so it never needed a constant — and the value has

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ treg oauth connect gsc --client-secret client_secret.json \
221221

222222
Full options for every command: [`USAGE.md`](USAGE.md).
223223

224+
The CLI sends anonymous command usage to PostHog when using treg.to (no arguments or credentials).
225+
Disable with `TREG_TELEMETRY=0` or `DO_NOT_TRACK=1`.
226+
See [analytics details](USAGE.md#anonymous-usage-analytics).
227+
224228
## Teams
225229

226230
Everything is scoped to an **org**: a token = a `(user, org)` membership, and every secret, tool,

‎USAGE.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,3 +460,15 @@ credential that stops working and webhooks the owner (if a `webhook_url` was set
460460
- `secret_file` — a JSON token file; pull `secret_field`
461461
- `oauth` — a JSON OAuth token; pull `secret_field` (auto-refreshed if refreshable)
462462
- `cli_auth` — material lifted from a CLI's keychain (placed like a string)
463+
464+
## Anonymous usage analytics
465+
466+
When using treg.to, the CLI sends basic usage through PostHog: command name, success/exit code,
467+
duration, CLI version and OS, linked to a random local installation ID. It does not send command
468+
arguments, credentials, request/response content, email or team identifiers. Help and argument
469+
parsing errors are not tracked. Analytics adds at most 1 second of waiting at command exit;
470+
slow or offline delivery may be dropped.
471+
472+
Disable it with `export TREG_TELEMETRY=0` (or `DO_NOT_TRACK=1`). Self-hosted registries default to
473+
no analytics; set `TREG_CLI_POSTHOG_KEY` and optionally `TREG_CLI_POSTHOG_HOST` to use your own
474+
PostHog project. The random ID is stored in `analytics-id` beside the CLI config file.

‎docs/context/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ covers (frontmatter `sources:`). Regenerate this index with
4040
|---|---|---|
4141
| [The API — the only brain (FastAPI)](interface/api.md) | shipped | sitetrack.js, api.py, bootstrap_handlers.py, bootstrap_http.py, … |
4242
| [Catalog browse review — categories, platform placement, and domain sections](interface/catalog-review-proposal.md) | reference | store.py, capabilities.yaml |
43-
| [The CLI (treg) + skill scaffolding](interface/cli.md) | shipped | cli.py, convert.py, agents.py |
43+
| [The CLI (treg) + skill scaffolding](interface/cli.md) | shipped | cli.py, cli_analytics.py, convert.py, agents.py |
4444
| [The web dashboard (Ledger, served from FastAPI)](interface/dashboard.md) | shipped | sitetrack.js, index.html, README.md, vue-3.5.41.global.prod.js, … |
4545
| [Import — scan a .env AND/OR a skills dir, auto-register as tools + bundles](interface/env-import.md) | in-progress | providers.py, skills.py |
4646
| [Landing sandbox backend - front-end entry removed](interface/landing-sandbox.md) | shipped | sandbox.py, sandbox_identity.py, pubfeed.py, sandbox.py, … |

‎docs/context/interface/cli.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: The CLI (treg) + skill scaffolding
33
status: shipped
44
sources:
55
- src/treg/cli.py
6+
- src/treg/cli_analytics.py
67
- src/treg/convert.py
78
- src/treg/agents.py
89
related:
@@ -508,3 +509,19 @@ Switching teams is unaffected: an explicit `X-Treg-Org` header always beats the
508509
`treg catalog get <routed id>` prints the ROUTING PLAN (order, accepted identity, price, HIT, expected
509510
cost per hit) above the sibling table; the sibling table itself gained a HIT column (`stats.observed`
510511
`hit_rate`). `treg catalog <platform>` rows lead with the endpoint id and show the unified USD price.
512+
513+
## Anonymous CLI analytics
514+
515+
`main` calls `cli_analytics.track_command` after dispatch, including failures and interrupts.
516+
The PostHog Python SDK sends `cli_command_completed` with the handler's fixed command name,
517+
exit code, success, duration in milliseconds, package version and OS. Help/version flags and
518+
argument parsing failures exit before dispatch and emit nothing. No arguments, request/response
519+
bodies, paths, tokens, emails or team identifiers are collected. A random UUID in `analytics-id`
520+
beside `TREG_CONFIG` identifies an installation; it is independent of login/logout.
521+
522+
The public treg.to ingestion token is the default only for the hosted registry and its legacy
523+
alias. Self-hosted URLs send nothing unless `TREG_CLI_POSTHOG_KEY` is set; the host override is
524+
`TREG_CLI_POSTHOG_HOST` (default EU ingestion). `TREG_TELEMETRY=0` or `DO_NOT_TRACK=1` disables
525+
all analytics and ID creation. SDK import and synchronous capture run in a daemon thread with
526+
no retries, a 0.2-second request timeout and a 1-second caller wait budget. Slow delivery may
527+
be dropped at exit; telemetry failures are silent and preserve command output and exit status.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "treg-dsh",
3-
"version": "0.17.0",
3+
"version": "0.18.0",
44
"type": "module",
55
"description": "OpenRouter for tools - 2,896 agent-friendly tools, pay for the usage, not subscription",
66
"main": "dsh/index.js",

‎plugin/.codex-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "treg",
3-
"version": "0.17.0",
3+
"version": "0.18.0",
44
"description": "Reach for this first for external or live data — 2,896 curated API endpoints across 60 providers (SEO, SERP, backlinks, social, enrichment, ads, web data), plus your team's own tools.",
55
"author": {
66
"name": "superdesign",

0 commit comments

Comments
 (0)