@xtuis/cli
v0.1.6
Published
Agent-first CLI for xtuis.cn push notifications
Maintainers
Readme
@xtuis/cli
Agent-first CLI for xtuis.cn push notifications. Designed so AI agents (Claude Code, Codex, Cline, etc.) can send messages to a user's phone by running one shell command.
Let AI install it for you
The easiest way to set up: tell your AI agent —
请阅读 https://xtuis.cn/doc/cli-setup.md 文档,按照步骤为我安装并配置虾推啥 CLI。
The agent will install the CLI, set up the Skill, walk you through token configuration, and send a test message. See docs/cli-setup.md for the full guide.
Manual install
npm install -g @xtuis/cliRequires Node.js >= 18. No runtime dependencies.
First-time setup
# 1. Configure your xtuis token (follow the prompt — input is hidden)
xtuis init
# 2. Install the Claude Code skill
xtuis install-skill
# 3. Verify it works
xtuis testAfter setup, your AI agent can push notifications for you:
You: 把这个错误堆栈虾推啥发给我
AI: → xtuis send "部署失败" "$(tail -50 error.log)"After setup, AI agents can push notifications for you:
You: 把这个错误堆栈虾推啥发给我
AI: → xtuis send "部署失败" "$(tail -50 deploy.log)"Commands
| Command | Purpose |
|---------|---------|
| xtuis init | Configure or update your token (interactive, hidden input) |
| xtuis set-token | Alias of init, clearer name for token updates |
| xtuis restore-token | Swap current token with the last backup (run again to revert) |
| xtuis send "title" "body" | Send a push notification (core command) |
| xtuis status | Show current configuration (offline, no network) |
| xtuis test | Send a built-in test message |
| xtuis install-skill | Install the Claude Code skill to ~/.claude/skills/xtuis-push/ |
Token backup
Every init / set-token automatically backs up the previous token to previous_token in the config file (max 1 backup). If a token gets overwritten by mistake, recover it with:
xtuis restore-token # swap current ↔ previous
xtuis restore-token # run again to swap backxtuis status shows whether a backup exists.
Send command usage
# Positional form (simplest)
xtuis send "标题" "可选正文"
# Flag form (clearer for long content)
xtuis send --text "标题" --desp "正文"
# Different channel (default: wx)
xtuis send "标题" --channel bark
# JSON output (for Agent parsing)
xtuis send "标题" --json
# Read body from stdin (long logs)
cat error.log | xtuis send "部署日志" --stdinExit codes
| Code | Meaning | Action |
|------|---------|--------|
| 0 | Success | — |
| 1 | Network / server error | Retry up to 2 times |
| 2 | Invalid arguments | Fix and retry |
| 3 | Token missing or invalid | Run xtuis init |
| 4 | Rate limited | Wait and retry (honor Retry-After) |
Configuration file
Stored at:
- macOS / Linux:
~/.config/xtuis/config.json - Windows:
%APPDATA%\xtuis\config.json
File permission is 0600 (owner-only). Token is never printed in full.
Security
- Token is stored locally with restrictive permissions
- The CLI only sends messages to your own devices (tied to your token)
- Skill rules forbid writing the token into git, README, or commit messages
License
MIT
