@wowazun/papu
v0.1.0
Published
push する前に腕立て伏せ (papu = push after a push-up)。スマホの加速度センサーで腕立てを検出し、CLI にカラフルな進捗バーを表示する。
Downloads
172
Maintainers
Readme
papu 💪
papu = push after a push-up.
⚠️ This is a for-fun / novelty project — basically a joke that happens to work. Use it for laughs, not in serious workflows.
Do your push-ups before you git push. papu installs a git pre-push hook that
blocks your push until you finish a set of push-ups. It detects reps from your
phone's motion sensor and shows a colorful live progress bar in your terminal.
How it works
git push
└─ the git pre-push hook launches `papu gate`
├─ starts a local HTTPS + WebSocket server
├─ prints a QR code in the terminal
├─ scan it with your phone → allow DeviceMotion → stream acceleration
├─ put the phone in your pocket and do push-ups → the bar fills up
└─ target reached → exit 0 (push proceeds) / aborted → exit 1 (push blocked)Why HTTPS? Reading a phone's motion sensor (DeviceMotion) in the browser requires a secure context. Plain
httpto a LAN IP is treated as insecure, sopapuserves over HTTPS with a self-signed certificate. The first time, your phone shows a certificate warning — tap through it to continue (both devices must be on the same Wi-Fi).
Requirements
- Node.js >= 20
- A phone with a motion sensor (iOS Safari / Android Chrome) on the same Wi-Fi as your computer
Install
npm install -g @wowazun/papuThe package is published under the @wowazun scope, but the command it installs
is just papu.
Usage
Enable push-up enforcement in any git repository:
cd path/to/your-repo
papu install # add the git pre-push hook
papu target 20 # reps required for this repo (optional, default 10)Now git push in that repo requires push-ups. Remove it with papu uninstall.
- The hook calls
nodeandpapuby absolute path, so it works without any project-local install. - The target is stored per repo in
.papurc.json. - The certificate is cached in
~/.papu, so you only accept the warning once.
Commands
papu doctor # check environment and LAN IP
papu target 20 # save the required reps (persisted)
papu target # show the current target
papu gate # start a gate using the saved target
papu gate --target 10 # override the target for this run
papu gate --target 10 --no-sound # mute the PC-side beeps
papu gate --target 3 --simulate # try it without a phone
papu lang # show current language
papu lang ja # switch messages to Japanese (default: English)Language
Messages default to English. Switch with any of:
papu lang ja(persisted to.papurc.json)--lang jaon any command- the
PAPU_LANGenvironment variable
The phone page and its voice prompts follow the same language.
Configuration
Drop a .papurc.json in your repo to override defaults:
{
"target": 10,
"port": 4443,
"threshold": 3.0,
"refractoryMs": 700,
"plankAngleDeg": 45,
"calibrationMs": 1200
}Start detection (posture-gated)
Detecting the start from "movement" alone is unreliable (getting into position
also shakes the phone). Instead papu uses gravity direction to detect your
posture and only counts reps once you are in a plank. Walking or inserting the
phone while standing never counts, because the gravity direction doesn't change.
- Tap "start" on the phone → stay still while standing (records the baseline gravity direction)
- Getting into a plank tilts gravity ~90° → detected as the start of counting
- Reps are counted only during the plank. Standing up stops it automatically.
Since you can't watch the screen mid-push-up, the phone speaks the count ("start", "1, 2, 3…", "done") and vibrates on Android.
plankAngleDeg: how many degrees of tilt from standing counts as a plank (default 45°)calibrationMs: how long to hold still to capture the standing baseline (default 1.2s)
Development
git clone https://github.com/wowazun/papu.git
cd papu
npm install
npm run build
npm link # makes `papu` available on your PATH
npm testRoadmap
--tunnel(ngrok / cloudflared) for a warning-free connection method- VSCode extension (a "Push (with push-ups)" command running gate →
git pushin a webview) - Calibration (
gate --calibrate) to auto-tune thresholds - Scale reps to the number of commits being pushed
Security notes
papu is meant for a trusted home network. Keep in mind:
- It runs a local HTTPS + WebSocket server on your LAN. The connection is not authenticated, so anyone on the same network could connect and send fake reps. Use it on a trusted Wi-Fi, not on public/guest networks.
- It serves over HTTPS with a self-signed certificate (cached in
~/.papu), so your phone shows a certificate warning the first time. papu installwrites a gitpre-pushhook into the current repository. Remove it any time withpapu uninstall.
Found a security issue? Please open an issue on GitHub.
Disclaimer
papu is a for-fun / novelty project built as a joke. It works, but it isn't meant for serious or production use. It is provided as is, with no warranty and no support guarantees, and is maintained on a best-effort basis. Have fun with it. 💪
License
MIT © wowazun
