{"_id":"@allmightypush/push-cli","name":"@allmightypush/push-cli","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@allmightypush/push-cli","version":"1.0.0","description":"Command-line interface tools for push notification library","main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/types/index.d.ts","bin":{"push-cli":"dist/cjs/cli.js"},"exports":{".":{"require":"./dist/cjs/index.js","import":"./dist/esm/index.js","types":"./dist/types/index.d.ts"}},"scripts":{"build":"npm run build:cjs && npm run build:esm && npm run build:types","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","build:types":"tsc -p tsconfig.types.json","test":"jest --passWithNoTests","test:watch":"jest --watch","test:coverage":"jest --coverage --passWithNoTests","clean":"rm -rf dist"},"keywords":["push","notification","cli","tools"],"author":{"name":"Samtes64"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Samtes64/all-mighty-push.git","directory":"packages/push-cli"},"bugs":{"url":"https://github.com/Samtes64/all-mighty-push/issues"},"homepage":"https://github.com/Samtes64/all-mighty-push/tree/main/packages/push-cli#readme","dependencies":{"@allmightypush/push-core":"^1.0.0","commander":"^11.1.0"},"engines":{"node":">=16.0.0"},"_id":"@allmightypush/push-cli@1.0.0","gitHead":"8d7b012f519f95515344d9b5c96d4ba42039046b","_nodeVersion":"22.19.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-tpQNTFoh2N8Boq8g5LGGBbVK/yGwOb+No5GhRfFNu66KI9ED0tFFH5VQKeHrBW+mtgx9PL34q5kuab0y7ojMtQ==","shasum":"34d54d1ef87db621c3931bbdf8c0a7c39a931e46","tarball":"https://registry.npmjs.org/@allmightypush/push-cli/-/push-cli-1.0.0.tgz","fileCount":14,"unpackedSize":60133,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBhm10Ni6YHpP13N0tlPYlW/KgbcWFpXcCmV0AExjN1jAiEAogBi8X3OpPzyhO+/okdedds3nBOStYbGLjccWug/x/8="}]},"_npmUser":{"name":"samtes64","email":"samtes64@gmail.com"},"directories":{},"maintainers":[{"name":"samtes64","email":"samtes64@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/push-cli_1.0.0_1768561620132_0.4369638233098252"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-16T11:07:00.019Z","1.0.0":"2026-01-16T11:07:00.274Z","modified":"2026-01-16T11:07:00.479Z"},"maintainers":[{"name":"samtes64","email":"samtes64@gmail.com"}],"description":"Command-line interface tools for push notification library","homepage":"https://github.com/Samtes64/all-mighty-push/tree/main/packages/push-cli#readme","keywords":["push","notification","cli","tools"],"repository":{"type":"git","url":"git+https://github.com/Samtes64/all-mighty-push.git","directory":"packages/push-cli"},"author":{"name":"Samtes64"},"bugs":{"url":"https://github.com/Samtes64/all-mighty-push/issues"},"license":"MIT","readme":"# @allmightypush/push-cli\n\nCommand-line interface tools for the push notification library.\n\n## Installation\n\n```bash\nnpm install -g @allmightypush/push-cli\n```\n\nOr use with npx:\n\n```bash\nnpx @allmightypush/push-cli <command>\n```\n\n## Commands\n\n### init\n\nCreate a push notification configuration file.\n\n```bash\npush-cli init [options]\n\nOptions:\n  -o, --output <path>  Output file path (default: \"push.config.js\")\n```\n\nExample:\n\n```bash\npush-cli init\npush-cli init --output config/push.js\n```\n\n### generate-keys\n\nGenerate VAPID keys for push notifications.\n\n```bash\npush-cli generate-keys [options]\n\nOptions:\n  -o, --output <path>     Output file path (optional)\n  -f, --format <format>   Output format: json, env, or text (default: \"text\")\n```\n\nExamples:\n\n```bash\n# Print to console\npush-cli generate-keys\n\n# Save to file\npush-cli generate-keys --output vapid-keys.json --format json\n\n# Generate .env format\npush-cli generate-keys --output .env.vapid --format env\n```\n\n### migrate\n\nRun database migrations.\n\n```bash\npush-cli migrate [options]\n\nOptions:\n  -d, --database <path>  Database file path (SQLite) (default: \"./push.db\")\n  -t, --type <type>      Database type: sqlite, postgres, or mongo (default: \"sqlite\")\n  -u, --uri <uri>        Database connection URI (for postgres/mongo)\n```\n\nExamples:\n\n```bash\n# SQLite\npush-cli migrate --database ./push.db\n\n# PostgreSQL\npush-cli migrate --type postgres --uri postgresql://user:pass@localhost:5432/push\n\n# MongoDB\npush-cli migrate --type mongo --uri mongodb://localhost:27017 --database push_notifications\n```\n\n### send-test\n\nSend a test notification to a subscription.\n\n```bash\npush-cli send-test [options]\n\nRequired Options:\n  -e, --endpoint <url>      Push service endpoint URL\n  -p, --p256dh <key>        P256DH public key\n  -a, --auth <key>          Auth secret\n  --public-key <key>        VAPID public key\n  --private-key <key>       VAPID private key\n  --subject <email>         VAPID subject (mailto: email)\n\nOptional:\n  -t, --title <title>       Notification title (default: \"Test Notification\")\n  -b, --body <body>         Notification body (default: \"This is a test notification\")\n  -i, --icon <url>          Notification icon URL\n```\n\nExample:\n\n```bash\npush-cli send-test \\\n  --endpoint \"https://fcm.googleapis.com/fcm/send/...\" \\\n  --p256dh \"BNc...\" \\\n  --auth \"tBH...\" \\\n  --public-key \"BDd...\" \\\n  --private-key \"...\" \\\n  --subject \"mailto:admin@example.com\" \\\n  --title \"Hello\" \\\n  --body \"Test message\"\n```\n\n### worker\n\nStart the retry worker process.\n\n```bash\npush-cli worker [options]\n\nOptions:\n  -c, --config <path>    Configuration file path (default: \"push.config.js\")\n  -d, --database <path>  Database file path (SQLite) (default: \"./push.db\")\n  -t, --type <type>      Database type: sqlite, postgres, or mongo (default: \"sqlite\")\n  -u, --uri <uri>        Database connection URI (for postgres/mongo)\n```\n\nExamples:\n\n```bash\n# With configuration file\npush-cli worker --config push.config.js\n\n# SQLite\npush-cli worker --database ./push.db\n\n# PostgreSQL\npush-cli worker --type postgres --uri postgresql://user:pass@localhost:5432/push\n\n# MongoDB\npush-cli worker --type mongo --uri mongodb://localhost:27017 --database push_notifications\n```\n\nThe worker will run until you press Ctrl+C. It handles graceful shutdown automatically.\n\n### doctor\n\nRun sanity checks on configuration and environment.\n\n```bash\npush-cli doctor [options]\n\nOptions:\n  -c, --config <path>    Configuration file path (default: \"push.config.js\")\n  -d, --database <path>  Database file path (SQLite) (default: \"./push.db\")\n```\n\nExample:\n\n```bash\npush-cli doctor\n```\n\nChecks:\n- ✓ Configuration file exists and is valid\n- ✓ VAPID keys are configured\n- ✓ Storage configuration is present\n- ✓ Database file exists (SQLite)\n- ✓ Environment variables are set\n- ✓ Node.js version is compatible\n\n## Configuration File\n\nThe `init` command creates a configuration file with this structure:\n\n```javascript\nmodule.exports = {\n  vapidKeys: {\n    publicKey: 'YOUR_PUBLIC_KEY',\n    privateKey: 'YOUR_PRIVATE_KEY',\n    subject: 'mailto:your-email@example.com',\n  },\n  storage: {\n    type: 'sqlite',\n    filename: './push.db',\n  },\n  retryPolicy: {\n    maxRetries: 8,\n    baseDelay: 1000,\n    backoffFactor: 2,\n    maxDelay: 3600000,\n    jitter: true,\n  },\n  circuitBreaker: {\n    failureThreshold: 5,\n    resetTimeout: 60000,\n  },\n  batchConfig: {\n    batchSize: 50,\n    concurrency: 10,\n  },\n  worker: {\n    pollInterval: 5000,\n    concurrency: 10,\n    batchSize: 50,\n  },\n};\n```\n\n## Environment Variables\n\nThe CLI respects these environment variables:\n\n- `VAPID_PUBLIC_KEY` - VAPID public key\n- `VAPID_PRIVATE_KEY` - VAPID private key\n- `VAPID_SUBJECT` - VAPID subject (mailto: email)\n- `PGHOST`, `PGPORT`, `PGDATABASE`, `PGUSER`, `PGPASSWORD` - PostgreSQL connection\n\n## Quick Start\n\n```bash\n# 1. Initialize configuration\npush-cli init\n\n# 2. Generate VAPID keys\npush-cli generate-keys --output vapid-keys.json --format json\n\n# 3. Update push.config.js with the generated keys\n\n# 4. Run migrations\npush-cli migrate\n\n# 5. Start the worker\npush-cli worker\n\n# 6. (Optional) Run sanity checks\npush-cli doctor\n```\n\n## Production Deployment\n\n### Systemd Service\n\nCreate `/etc/systemd/system/push-worker.service`:\n\n```ini\n[Unit]\nDescription=Push Notification Worker\nAfter=network.target\n\n[Service]\nType=simple\nUser=push\nWorkingDirectory=/opt/push-notifications\nExecStart=/usr/bin/node /opt/push-notifications/node_modules/.bin/push-cli worker\nRestart=always\nRestartSec=10\n\n[Install]\nWantedBy=multi-user.target\n```\n\nEnable and start:\n\n```bash\nsudo systemctl enable push-worker\nsudo systemctl start push-worker\nsudo systemctl status push-worker\n```\n\n### Docker\n\n```dockerfile\nFROM node:18-alpine\n\nWORKDIR /app\n\nCOPY package*.json ./\nRUN npm ci --production\n\nCOPY . .\n\nCMD [\"npx\", \"@allmightypush/push-cli\", \"worker\"]\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-bba39d5a6eed5fe0950f2d2de5fc16a0"}