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.
Insights demo project
Testing local changes to packages
This is a simple project used to test local changes to the Insights JS SDK packages.
Quick Start (Recommended)
Use the provided script that handles building, packaging, and running the dev server:
cd playground/nextjs
./bin/localdev.sh
With environment variables:
NEXT_PUBLIC_INSIGHTS_KEY='<your-local-api-key>' NEXT_PUBLIC_INSIGHTS_HOST='http://localhost:8010' ./bin/localdev.sh
This script will:
- Build all packages in the monorepo
- Package them into tarballs
- Install dependencies in the playground
- Start the dev server
Open http://localhost:3000?__insights_debug=true to see debug logs.
Manual Setup
If you prefer to run steps manually:
- From the root of the repo, build and package:
pnpm install
pnpm build
pnpm package
- From this folder, install dependencies and run dev:
pnpm install
NEXT_PUBLIC_INSIGHTS_KEY='<your-local-api-key>' NEXT_PUBLIC_INSIGHTS_HOST='http://localhost:8010' pnpm dev
How it works
The playground is excluded from the workspace (see pnpm-workspace.yaml). Dependencies are rewritten by playground/.pnpmfile.cjs to use tarballs from the target/ directory instead of workspace links. This means you must run pnpm package after making changes to see them in the playground.
Testing cross-subdomain tracking
We can locally debug the cross-domain behaviour of @hanzo/insights by editing our /etc/hosts file to point some fake subdomains to localhost. There are a few steps required to do this, these are the instructions for doing this on MacOS with Chrome:
Add the following to your /etc/host file:
127.0.0.1 www.insights.dev
127.0.0.1 app.insights.dev
To restart your DNS server on MacOS, run:
sudo killall -HUP mDNSResponder
Run this modified command to start the server. It will ask you to for sudo permissions to create a self-signed cert for https.
NEXT_PUBLIC_INSIGHTS_KEY='<your-local-api-key>' NEXT_PUBLIC_INSIGHTS_HOST='http://localhost:8000' pnpm dev-crossdomain
You can now open the subdomains we added to the host file, but you will likely see a warning about unsafe certificates. To get around this, in Chrome you can type thisisunsafe to bypass the warning.
The subdomains are:
Surveys testing guide
See surveys/CONTRIBUTING.md in the main insights repo for more details