sahnik
v1.0.2
Published
CLI tool to interact with Sahnik's AI assistant
Maintainers
Readme
Sahnik CLI
A command-line interface to interact with Sahnik's AI assistant. Ask questions and learn about Sahnik without needing your own API key!
🚀 Installation
For Users
Install globally from npm:
npm install -g sahnikFor Development
Clone the repository and link locally:
npm install
npm link📖 Usage
Available Commands
# Learn about Sahnik
sahnik about
# Ask a question
sahnik ask "What tech stack does Sahnik use?"
sahnik ask "Tell me about Sahnik's projects"
# Show help
sahnik help
# Show version
sahnik versionExamples
$ sahnik about
⠋ Thinking...
🤖 Sahnik AI:
Sahnik is a talented developer...
$ sahnik ask "What programming languages does he know?"
⠋ Thinking...
🤖 Sahnik AI:
Sahnik is proficient in JavaScript, TypeScript, Python...⚙️ Configuration
For development or if you're running your own backend:
- Copy
.env.exampleto.env - Update the configuration:
BACKEND_URL=http://localhost:3000
AUTH_KEY=your-shared-secret-keyNote: For published npm package, these values are embedded during build.
🏗️ Development
Testing Locally
# Install dependencies
npm install
# Link the CLI globally
npm link
# Test commands
sahnik about
sahnik ask "test question"Before Publishing
- Ensure backend is deployed and running
- Update
.envwith production backend URL - Update version in
package.json - Test thoroughly with
npm link
📦 Publishing to npm
First Time Setup
Create npm account: npmjs.com/signup
Login locally:
npm loginVerify package name is available:
npm search sahnikIf taken, choose a different name in
package.json
Publishing Steps
Update version in
package.json:{ "version": "1.0.0" // or 1.0.1, 1.1.0, etc. }Test locally:
npm link sahnik aboutPublish:
npm publishVerify:
npm install -g sahnik sahnik about
Publishing Updates
Make your changes
Update version (semantic versioning):
- Patch (1.0.0 → 1.0.1): Bug fixes
- Minor (1.0.0 → 1.1.0): New features, backwards compatible
- Major (1.0.0 → 2.0.0): Breaking changes
# Auto-increment version npm version patch # 1.0.0 → 1.0.1 npm version minor # 1.0.0 → 1.1.0 npm version major # 1.0.0 → 2.0.0Publish update:
npm publishUsers can update:
npm update -g sahnik
🔧 Troubleshooting
"Command not found: sahnik"
- Ensure installed globally:
npm install -g sahnik - Check global install path:
npm root -g - Try reinstalling:
npm uninstall -g sahnik && npm install -g sahnik
"Cannot connect to backend server"
- Check internet connection
- Backend might be sleeping (Render free tier) - wait 30-60 seconds
- Verify backend is deployed and running
"Authentication failed"
- Contact package maintainer - auth key might be outdated
📁 Project Structure
cli/
├── bin/
│ └── sahnik.js # Main CLI executable
├── package.json # Package configuration
├── .env # Environment variables (development)
├── .env.example # Template
└── README.md # This file🔒 Security
- API key is never exposed to CLI users
- All requests go through authenticated backend
- Rate limiting prevents abuse
- Environment variables keep secrets safe
📄 License
MIT
🤝 Contributing
Issues and pull requests welcome!
📞 Support
For issues or questions, visit: https://github.com/sahnik/sahnik-cli
