kb-bot-cli
v1.1.17
Published
A CLI SDK similar to Botpress SDK for building and deploying projects
Downloads
36
Readme
kbcli
A powerful CLI SDK similar to Botpress SDK for building and deploying Node.js projects.
Installation
Global Installation (Recommended)
npm install -g kbcliLocal Installation
npm install kbcli
npx kbcli --helpFeatures
- 🔐 Authentication: Secure login/logout with token management
- 🏗️ Build: Bundle your project using esbuild for optimal performance
- 🚀 Deploy: Upload your built project to any server
- 📦 Cross-platform: Works on Windows, macOS, and Linux
- ⚡ Fast: Built with esbuild for lightning-fast builds
Usage
Login
Authenticate with your account to enable deployment features.
kbcli loginThis will prompt you for your email and password, then save your authentication token globally in ~/.kbcli/token.json.
Logout
Clear your saved authentication token.
kbcli logoutBuild
Bundle your project's source code into a distributable format.
# Basic build (uses src/index.js as entry point)
kbcli build
# Custom entry point and output directory
kbcli build --entry src/main.js --outdir build
# Short form
kbcli build -e src/app.js -o distOptions:
-e, --entry <file>: Entry point file (default:src/index.js)-o, --outdir <dir>: Output directory (default:dist)
Deploy
Upload your built project to a server.
# Basic deploy (uses dist/ directory)
kbcli deploy
# Custom directory and server
kbcli deploy --dir build --server https://api.myserver.com/deploy
# Short form
kbcli deploy -d dist -s https://api.example.com/uploadOptions:
-d, --dir <directory>: Directory to deploy (default:dist)-s, --server <url>: Server URL (default:https://api.example.com/deploy)
Project Structure
Your project should follow this structure:
my-project/
├── src/
│ └── index.js # Entry point
├── dist/ # Built files (created by kbcli build)
└── package.jsonConfiguration
The CLI stores your authentication token in:
- Windows:
%USERPROFILE%\.kbcli\token.json - macOS/Linux:
~/.kbcli/token.json
Examples
Complete Workflow
# 1. Login to your account
kbcli login
# 2. Build your project
kbcli build --entry src/index.js --outdir dist
# 3. Deploy to your server
kbcli deploy --dir dist --server https://api.mycompany.com/deploy
# 4. Logout when done
kbcli logoutDevelopment Workflow
# Quick build and deploy
kbcli build && kbcli deploy
# Build with custom settings
kbcli build -e src/app.js -o build
kbcli deploy -d build -s https://staging-api.example.com/deployAPI Integration
The deploy command sends a POST request to your server with:
- Content-Type:
multipart/form-data - Authorization:
Bearer <your-token> - Body: ZIP file containing your project
Your server should handle the multipart form data and extract the uploaded ZIP file.
Requirements
- Node.js 14.0.0 or higher
- npm or yarn package manager
Troubleshooting
Build Issues
- Ensure your entry file exists and is valid JavaScript
- Check that all dependencies are properly installed
- Verify file paths are correct
Deploy Issues
- Make sure you're logged in (
kbcli login) - Verify the server URL is correct and accessible
- Check your internet connection
- Ensure the server accepts the file format
Authentication Issues
- Try logging out and logging back in
- Check if your credentials are correct
- Verify the authentication server is accessible
License
MIT
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Support
For support, please open an issue on GitHub or contact the development team.
