feat: interactive postinstall onboarding for npm global installs#172
feat: interactive postinstall onboarding for npm global installs#172arein wants to merge 5 commits intoopen-wallet-standard:mainfrom
Conversation
After `npm install -g @open-wallet-standard/core`, users are walked through optional first-time setup: installing the OWS AI coding skill, creating their first wallet, and funding it with USDC via MoonPay. - Only runs on global installs + interactive TTY (silent in CI) - Zero external dependencies (Node.js built-ins only) - Errors never break installation (wrapped in .catch) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@arein is attempting to deploy a commit to the MoonPay Team on Vercel. A member of the Team first needs to authorize it. |
The postinstall script now checks for `ows` on $PATH as a final fallback, which covers the common case where the binary is already globally linked (e.g. via homebrew or a prior install). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix double-resolve in prompt() where the readline "close" event races with the question callback, resolving with "" (treated as default yes) before the actual answer is processed - Add "ows" to skill directory detection (the skill installs as ~/.claude/skills/ows, not ~/.claude/skills/core) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
rl.close() synchronously emits "close", which called done("") before
done(answer.trim()) had a chance to run. Swapping the order ensures
the actual user answer is captured first.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
njdawn
left a comment
There was a problem hiding this comment.
Medium — bindings/node/scripts/postinstall.js: this is described as a first-time onboarding flow, but it has no persisted completion marker and no wallet-exists check, so it re-prompts on every interactive global reinstall/upgrade. I verified this by simulating two TTY installs against the same HOME; both runs asked the same skill and wallet questions again. That makes npm install -g @open-wallet-standard/core upgrades repeatedly interactive instead of “first-time only”.
Low — bindings/node/scripts/postinstall.js: non-interactive global installs are not actually silent. With npm_config_global=true and piped stdin, the script still prints onboarding tips to stderr. That contradicts the PR summary and can add noise to automation or scripted installs that expect postinstall to stay quiet outside interactive use.
- Write ~/.ows/.onboarding-done after first interactive run so upgrades don't re-prompt - Remove stderr tips for non-interactive global installs (piped stdin) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Addressed both items in 384847a:
🤖 Generated with Claude Code |
Summary
postinstallscript that runs afternpm install -g @open-wallet-standard/coreand walks users through optional first-time setup:npx skills add https://github.com/open-wallet-standard/core --skill owsows wallet createows fund depositvia MoonPay (Base USDC)npm installreadline,child_process,fs).catch(() => {})so errors never break installationInspired by nansen-ai/nansen-cli#302.
Test plan
npm install -g .frombindings/node/— verify the onboarding flow triggersnmy-wallet)npm_config_global=false node scripts/postinstall.js— verify it exits silentlyecho "" | node scripts/postinstall.js) — verify non-interactive fallback tipsnpm packoutput🤖 Generated with Claude Code