npm package: @koodosbots/kprcli
Description: KprCli - Global CLI automation client for Telegram bot integration
Author: koodosbots
Latest version: 1.0.1

# KprCli - Telegram Bot Automation Client

[![npm version](https://badge.fury.io/js/%40kprcli%2Fclient.svg)](https://www.npmjs.com/package/@kprcli/client)
[![Node.js Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org/)

Global CLI client for connecting your computer to a Telegram bot for automation tasks.

## 🚀 Quick Install

```bash
npm install -g @kprcli/client
```

That's it! Now you can use `kprcli` anywhere.

## 📱 Usage

### 1. Link Your Device
```bash
kprcli login
```
- Go to your Telegram bot and run `/link`
- Copy the 6-digit code
- Enter it when prompted

### 2. Start Automation
```bash
kprcli start
```
Your device is now ready to execute automation tasks from Telegram!

### 3. Check Status
```bash
kprcli status  # View device info
kprcli help    # Show all commands
```

## 🎯 How It Works

1. **Install globally** - Available as `kprcli` command everywhere
2. **Link to Telegram** - Authenticate with your bot using a secure code
3. **Auto-execute tasks** - Your CLI polls for jobs and executes them
4. **Real-time feedback** - Results sent back to Telegram instantly

## 📋 Commands

| Command | Description |
|---------|-------------|
| `kprcli login` | Link device to Telegram bot |
| `kprcli start` | Start automation agent |
| `kprcli status` | Show device status |
| `kprcli help` | Show help information |

## 🔧 Requirements

- **Node.js 18+** (includes npm)
- **Internet connection**
- **Telegram bot** with KprCli integration

## 🌟 Features

- ✅ **Zero dependencies** - Pure Node.js, no external packages
- ✅ **Global installation** - Use `kprcli` from anywhere
- ✅ **Secure authentication** - 6-digit codes with expiration
- ✅ **Real-time polling** - Checks for jobs every 5 seconds
- ✅ **Graceful shutdown** - Press Ctrl+C to stop
- ✅ **Cross-platform** - Works on Windows, Mac, Linux
- ✅ **Auto-save credentials** - Remembers your login

## 🔒 Security

- Auth codes expire in 10 minutes
- Credentials saved locally in `.kprcli-config`
- No sensitive data transmitted
- Device linking required per machine

## 📝 Example Session

```bash
$ kprcli login
🤖 KprCli Login
===============
1. Go to your Telegram bot and run /link
2. Copy the 6-digit code from Telegram

Enter authentication code: ABC123
🔐 Authenticating with code: ABC123
✅ Device authenticated successfully!
📱 Device ID: 12345678-abcd-efgh...
💾 Credentials saved to .kprcli-config

$ kprcli start
🚀 KprCli Agent Starting...
📱 Device: 12345678...
🔄 Polling for jobs every 5 seconds
Press Ctrl+C to stop

📬 Found 1 job(s):
  • Job ID: task-456
  • Task: form_fill  
  • Status: pending

⚡ Executing job: task-456...
✅ Job task-456... completed successfully
```

## 🐛 Troubleshooting

### "Command not found: kprcli"
```bash
# Reinstall globally
npm uninstall -g @kprcli/client
npm install -g @kprcli/client
```

### "Authentication failed"
- Make sure you copied the exact 6-digit code from Telegram
- Codes expire in 10 minutes - get a fresh one with `/link`
- Check that your bot is running and accessible

### "Connection error"
- Verify your bot server is running on the correct port
- Check firewall settings
- Ensure you have internet connectivity

## 📄 License

MIT License - see [LICENSE](LICENSE) file for details.

## 🤝 Support

- 🐛 Report bugs: [GitHub Issues](https://github.com/yourusername/kprcli/issues)
- 💬 Ask questions: [Telegram Support](https://t.me/kprcli_support)
- 📚 Documentation: [Wiki](https://github.com/yourusername/kprcli/wiki)

---

**Made with ❤️ by the KprCli Team**