Files
insights-js/LLM.md
zooqueen a93e642791 chore: complete posthog->insights rebrand (zero @posthog/* identity)
Decomplect the half-finished fork so the dependency graph has ONE source
with no posthog package identity, living under github.com/hanzoinsights.

LAYER 1 (package identity): rename straggler package.json names —
@posthog/next->@hanzo/insights-next (Next.js SDK; distinct from the existing
@hanzo/insights-nextjs config helper), @posthog/mcp->@hanzo/insights-mcp,
@posthog/plugin-utils->@hanzo/insights-plugin-utils,
@posthog/react-slim->@hanzo/react-slim, @posthog-tooling/release->
@hanzo/insights-tooling-release, and the @posthog/rrweb* family->@hanzo/rrweb*
(matching the already-published @hanzo/rrweb*@0.0.47 + minimumReleaseAgeExclude).
Repoint every repository.url/homepage/bugs to github.com/hanzoinsights/insights-js
and rebrand the PostHog author/description identity to Hanzo AI.

LAYER 2 (cross-package imports): rewrite every internal @posthog/* import to its
@hanzo/insights*|@hanzo/rrweb* equivalent and the bare module specifiers
posthog-js->@hanzo/insights, posthog-node->@hanzo/insights-node, mirrored in
package.json deps + the pnpm-lock importer keys. Result: 0 @posthog/* specifiers
in packages/tooling/examples/playground source.

LAYER 4 (wire protocol) PRESERVED: window.posthog global, ph_* keys,
$-prefixed event names, distinct_id, /decide, /e/, /flags, and the
__PosthogExtensions__ hook are left unchanged — the Insights server expects them.

Also repair pre-existing fork merge damage that blocked compilation (unrelated to
naming; identical to origin/main): restore the @hanzo/insights-core ./process
subpath (spawn-local/utils, re-matching the published artifact), the lost
constructor/var declarations in core + node clients, the mangled
external-scripts-loader, the missing TreeShakeable/isPlainError imports, the
DeviceId enum member, and stale ../posthog-core-stateless module paths. 26/34
turbo build tasks now pass; remaining failures (browser/react-native and their
dependents) are pre-existing fork damage, not rebrand-caused.
2026-06-19 18:44:26 -07:00

2.5 KiB

insights-js

Hanzo Insights JS — monorepo of analytics SDKs (browser, node, react, react-native, nextjs, nuxt, ai, convex, mcp) plus a vendored rrweb session-replay stack.

Fork of PostHog's posthog-js monorepo, fully rebranded to the Hanzo Insights identity and published under the @hanzo/* npm scope. Canonical repo: github.com/hanzoinsights/insights-js.

Provides analytics, feature flags, session replay, and A/B testing for web and Node.js applications connected to Hanzo Insights.

Package naming (one scheme, no posthog)

  • SDKs: @hanzo/insights (browser), @hanzo/insights-core, @hanzo/insights-types, @hanzo/insights-node, @hanzo/insights-react, @hanzo/insights-react-native, @hanzo/insights-ai, @hanzo/insights-next (Next.js SDK integration), @hanzo/insights-nextjs (Next.js build/sourcemap config helper — distinct package), @hanzo/insights-nuxt, @hanzo/insights-convex, @hanzo/insights-mcp, @hanzo/insights-lite, @hanzo/insights-plugin-utils, @hanzo/insights-rollup-plugin, @hanzo/insights-webpack-plugin.
  • Vendored rrweb stack keeps the @hanzo/rrweb* scheme (matches the already-published @hanzo/rrweb*@0.0.47 artifacts + minimumReleaseAgeExclude in pnpm-workspace.yaml): @hanzo/rrweb, @hanzo/rrweb-types, @hanzo/rrweb-snapshot, @hanzo/rrweb-utils, @hanzo/rrdom, @hanzo/rrweb-record, @hanzo/rrweb-replay, @hanzo/rrweb-all, @hanzo/rrweb-packer, and the @hanzo/rrweb-plugin-* family.
  • Tooling: @hanzo/insights-tooling-* and eslint-plugin-insights.

There must be ZERO @posthog/* dependency or identity references in source. Verify: grep -rl '@posthog/' packages --include='*.ts' --include='package.json' | grep -v node_modules → 0.

Wire protocol — DO NOT rebrand (server contract)

The Insights ingestion server is a posthog-protocol fork and expects the on-the-wire constants UNCHANGED. Never rename these — they are values, not package identifiers:

  • the window.posthog global variable name (UMD output.globals value),
  • ph_* cookie / localStorage persistence keys,
  • $-prefixed event names ($pageview, $identify, $autocapture, $set, …),
  • distinct_id, the /decide, /e/, /flags endpoints,
  • the __PosthogExtensions__ / __InsightsExtensions__ runtime hook (mixed in the fork).

Package import specifiers posthog-js / posthog-node ARE rebranded to @hanzo/insights / @hanzo/insights-node (those are package names, not wire constants).