fix: remove --provenance for private repo publish#14
Conversation
- Add scripts/postinstall.mjs — fires package_installed PostHog event on npm install; warns if hooks config exists but hooks aren't registered - Add scripts/preuninstall.mjs — auto-removes failproofai hook entries from Claude Code settings on npm uninstall; fires package_uninstalled event - Add scripts/install-telemetry.mjs — shared fetch-based PostHog helper for lifecycle scripts (no external deps, mirrors hook-telemetry pattern) - Add postinstall/preuninstall entries to package.json scripts - Guard both scripts with INIT_CWD check so they skip during dev/CI installs - Fix scripts/launch.ts: resolve .next/standalone/server.js to an absolute path via import.meta.url — previously the dashboard would fail to start when failproofai was run from any directory other than the package root Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
npm provenance requires the source repository to be public. Re-add --provenance (and id-token: write permission) when the repo goes public. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe pull request introduces npm package lifecycle hooks integrated with PostHog telemetry tracking. A new telemetry module provides install/uninstall event tracking with stable instance identification. Postinstall registers hooks and sends telemetry; preuninstall cleans up hook entries from Claude Code settings and sends uninstall telemetry. Minor CI/CD and filesystem path adjustments included. Changes
Sequence DiagramssequenceDiagram
actor npm as npm (install)
participant hooks as postinstall.mjs
participant telemetry as install-telemetry.mjs
participant storage as ~/.failproofai/
participant claude as ~/.claude/settings.json
participant posthog as PostHog API
npm->>hooks: trigger postinstall hook
hooks->>hooks: check INIT_CWD context
hooks->>storage: read hooks-config.json
hooks->>claude: inspect for failproofai entries
hooks->>hooks: compute hostname HMAC-SHA256
hooks->>telemetry: trackInstallEvent("package_installed", {platform, arch, ...})
telemetry->>storage: read/create instance-id
telemetry->>telemetry: derive distinct_id
telemetry->>posthog: fetch POST to /capture (5s timeout)
posthog-->>telemetry: response (fire-and-forget)
telemetry-->>hooks: resolve
hooks-->>npm: complete
sequenceDiagram
actor npm as npm (uninstall)
participant hooks as preuninstall.mjs
participant claude as ~/.claude/settings.json<br/>.claude/settings.json<br/>.claude/settings.local.json
participant telemetry as install-telemetry.mjs
participant storage as ~/.failproofai/
participant posthog as PostHog API
npm->>hooks: trigger preuninstall hook
hooks->>hooks: check INIT_CWD context
loop for each settings path
hooks->>claude: read JSON (deduped paths)
hooks->>hooks: filter hooks with __failproofai_hook__ marker
hooks->>hooks: prune empty arrays/objects
hooks->>claude: write if modified (best-effort)
end
hooks->>telemetry: trackInstallEvent("package_uninstalled", {...})
telemetry->>storage: read instance-id
telemetry->>posthog: fetch POST to /capture (5s timeout, awaited)
posthog-->>telemetry: response
telemetry-->>hooks: resolve (suppress errors)
hooks-->>npm: complete
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Summary
--provenancerequires the source repo to be public. npm returns E422 for private repos.--provenanceand theid-token: writepermission for now.To re-trigger after merge
v0.0.1-beta.1release on GitHub🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
FAILPROOFAI_TELEMETRY_DISABLED=1environment variable)Chores