feat(diagnostics): funnel events throughout setup with persisted install-id
Shared bash + node emitter in setup/lib/diagnostics.{sh,ts} reads/writes data/install-id so every event from a single install shares one distinct_id — bash-side setup_launched/setup_start, node-side auto_started, per-step started/completed, auth_method_chosen, channel_chosen, first_chat_ready/failed, setup_incomplete, setup_aborted, setup_completed. Opt-out via NANOCLAW_NO_DIAGNOSTICS=1.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
19
setup.sh
19
setup.sh
@@ -167,11 +167,20 @@ elif [ "$NATIVE_OK" = "false" ]; then
|
||||
STATUS="native_failed"
|
||||
fi
|
||||
|
||||
# Anonymous setup start event (non-blocking, best-effort)
|
||||
curl -sS --max-time 3 -X POST https://us.i.posthog.com/capture/ \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "{\"api_key\":\"phc_fx1Hhx9ucz8GuaJC8LVZWO8u03yXZZJJ6ObS4yplnaP\",\"event\":\"setup_start\",\"distinct_id\":\"$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid 2>/dev/null || echo unknown)\",\"properties\":{\"platform\":\"$PLATFORM\",\"is_wsl\":\"$IS_WSL\",\"is_root\":\"$IS_ROOT\",\"node_version\":\"$NODE_VERSION\",\"deps_ok\":\"$DEPS_OK\",\"native_ok\":\"$NATIVE_OK\",\"has_build_tools\":\"$HAS_BUILD_TOOLS\"}}" \
|
||||
>/dev/null 2>&1 &
|
||||
# Anonymous setup start event (non-blocking, best-effort). Uses the
|
||||
# persisted distinct_id from data/install-id so bash-side events and the
|
||||
# node-side funnel share one id.
|
||||
# shellcheck source=setup/lib/diagnostics.sh
|
||||
source "$PROJECT_ROOT/setup/lib/diagnostics.sh"
|
||||
ph_event setup_start \
|
||||
platform="$PLATFORM" \
|
||||
is_wsl="$IS_WSL" \
|
||||
is_root="$IS_ROOT" \
|
||||
node_version="$NODE_VERSION" \
|
||||
deps_ok="$DEPS_OK" \
|
||||
native_ok="$NATIVE_OK" \
|
||||
has_build_tools="$HAS_BUILD_TOOLS" \
|
||||
status="$STATUS"
|
||||
|
||||
cat <<EOF
|
||||
=== NANOCLAW SETUP: BOOTSTRAP ===
|
||||
|
||||
Reference in New Issue
Block a user