feat: Complete zCode CLI X with Telegram bot integration

- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation

🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
This commit is contained in:
admin
2026-05-05 09:01:26 +00:00
Unverified
parent 4a7035dd92
commit 875c7f9b91
24688 changed files with 3224957 additions and 221 deletions

215
README.md
View File

@@ -1,122 +1,159 @@
# Better-Clawd
# zCode CLI X
> Claude Code, but better.
Agentic coder with **Z.AI + Telegram integration** — Claude Code + Hermes in one beast.
Better-Clawd exists because the original had a genuinely great core idea and too many self-inflicted problems around it. This fork keeps what worked, fixes what did not, and gives people real choice over how they log in, which provider they use, and how much of the product they actually want phoning home.
## 🚀 Features
No telemetry. No vendor lock-in. Faster startup, lower idle overhead, and better long-session performance than the original Claude Code. Less corporate baggage.
- **🤖 AI-Powered Code Generation**: Powered by Z.AI GLM-5.1 (Coding Plan)
- **📱 Telegram Bot**: 24/7 live interaction via Telegram
- **🛠️ Full Engineering Access**: Bash, FileEdit, WebSearch, Git tools
- **🧠 Agent System**: Code reviewer, architect, DevOps engineer
- **📚 Skills System**: Pre-built skills for common tasks
- **⚡ Real-time Updates**: WebSocket-based live communication
[NPM package](https://www.npmjs.com/package/better-clawd)
## Install
## 📦 Installation
```bash
npm install -g better-clawd
cd zcode-cli-x
npm install
```
Or run it without a global install:
## ⚙️ Configuration
Copy `.env.example` to `.env` and configure:
```bash
npx better-clawd
cp .env.example .env
```
## Why This Exists
### Required Environment Variables
Claude Code had the bones of a best-in-class coding CLI, but too much of the experience was tied to one company, one backend, one set of assumptions, and one way of doing things.
```env
# Z.AI Configuration (Coding Plan)
GLM_BASE_URL=https://api.z.ai/api/coding/paas/v4
ZAI_API_KEY=your_zai_api_key_here
Better-Clawd is the response to that.
# Telegram Bot Configuration
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_ALLOWED_USERS=your_telegram_id
ZCODE_WEBHOOK_URL=https://your-domain.com/telegram/webhook
```
- It keeps the good parts of the original UX
- It removes telemetry and unnecessary phone-home behavior
- It supports multiple providers without turning setup into a science project
- It improves performance over the original Claude Code, with better startup behavior, less idle background churn, and smoother long sessions
- It is easier to inspect, modify, and run on your own terms
## 🎮 Usage
## Performance
Better-Clawd is intentionally tuned to be leaner than upstream Claude Code:
- Lower startup and initialization cost
- Less background polling and idle CPU churn
- Better memory and render behavior during long transcript-heavy sessions
- Focused performance workflow and regression checks in `PERFORMANCE.md`
## What Better-Clawd Changes
- Full Better-Clawd rebrand across the CLI, UI, config paths, installers, and app identity
- OpenAI support with API keys and Codex-based login import/refresh flow
- OpenRouter support with proper provider wiring
- Anthropic support kept for people who still want it
- Telemetry stripped out
- Upstream service dependencies reduced or removed where they made the project worse
- Local-first behavior wherever possible
## Provider Support
Better-Clawd currently supports:
- Anthropic login and API key flows
- OpenAI API keys
- OpenAI Codex login import and refresh flow
- OpenRouter API keys
Default endpoints:
- OpenAI base URL: `https://api.openai.com/v1`
- OpenAI websocket mode endpoint: `wss://api.openai.com/v1/responses`
- OpenRouter Anthropic-compatible base URL: `https://openrouter.ai/api`
- OpenRouter Responses API: `https://openrouter.ai/api/v1/responses`
## Quick Start
1. Run `better-clawd`
2. Run `/login`
3. Pick your provider and complete the flow
4. Run `/status` to confirm the active provider and auth method
The intended setup path is inside the CLI itself. Environment variables still work, but they are mostly useful for CI, headless usage, forced provider selection, or custom/proxied endpoints.
## Environment Examples
OpenAI:
### Run as CLI
```bash
BETTER_CLAWD_API_PROVIDER=openai
OPENAI_API_KEY=your_key_here
OPENAI_BASE_URL=https://api.openai.com/v1
node bin/zcode.js
```
OpenRouter:
### Run as Telegram Bot (24/7)
```bash
BETTER_CLAWD_API_PROVIDER=openrouter
OPENROUTER_API_KEY=your_key_here
OPENROUTER_BASE_URL=https://openrouter.ai/api
node bin/zcode.js --bot
```
## What You Get
### Run in Development Mode
- Better provider freedom
- Better performance than the original Claude Code across startup, idle usage, and long sessions
- OpenAI and OpenRouter support without weird bolt-on hacks
- Less phone-home behavior
- A CLI that feels more practical, more open, and more yours
```bash
node bin/zcode.js --dev
```
## Project Direction
### Run Only CLI (No Bot)
The direction is straightforward:
```bash
node bin/zcode.js --no-bot
```
- Keep the parts of Claude Code that were actually good
- Remove the parts that made it annoying, restrictive, or bloated
- Support multiple providers without making daily usage worse
- Keep the project useful instead of over-managed
## 🤖 Telegram Bot
If you liked the original idea but got tired of the lock-in, this is the fork.
Once running, you can interact with zCode CLI X via Telegram:
## Disclaimer
1. Start the bot: `/start`
2. Send your code requests or questions
3. Receive AI-powered responses in real-time
Better-Clawd is an independent, unofficial community project and is not affiliated with, endorsed by, or sponsored by Anthropic, PBC.
## 🛠️ Tools Available
`Claude`, `Claude Code`, and related names, marks, and branding are the property of Anthropic, PBC or their respective owners. They are referenced here only to describe compatibility, origin, and the purpose of this fork.
- **Bash**: Execute shell commands
- **FileEdit**: Edit files with diff-aware operations
- **WebSearch**: Search the web for information
- **Git**: Git operations (status, log, branch)
The intent here is interoperability, commentary, and fair reference, not impersonation.
## 🧠 Agents
- **Code Reviewer**: Review code for bugs and improvements
- **System Architect**: Design system architecture and patterns
- **DevOps Engineer**: Handle deployment, CI/CD, and infrastructure
## 📚 Skills
- **code_review**: Review code for bugs, security issues, and improvements
- **bug_fix**: Fix identified bugs in code
- **refactor**: Refactor code for better quality
- **documentation**: Generate and update documentation
- **testing**: Write tests for code
## 🏗️ Architecture
```
zcode-cli-x/
├── bin/
│ └── zcode.js # CLI entry point
├── src/
│ ├── api/
│ │ └── index.js # Z.AI API adapter
│ ├── bot/
│ │ └── index.js # Telegram bot integration
│ ├── tools/
│ │ ├── BashTool.js # Shell command executor
│ │ ├── FileEditTool.js # File operations
│ │ ├── WebSearchTool.js # Web search
│ │ └── GitTool.js # Git operations
│ ├── skills/
│ │ └── index.js # Skills system
│ ├── agents/
│ │ └── index.js # Agent orchestration
│ └── utils/
│ ├── logger.js # Winston logger
│ └── env.js # Environment validation
├── .env # Configuration
└── package.json
```
## 🔗 Integrations
- **Z.AI API**: GLM-5.1 model with Coding Plan
- **Telegram Bot API**: Webhook + WebSocket
- **Express.js**: HTTP server
- **Winston**: Logging
## 🚀 Getting Started
1. Install dependencies:
```bash
npm install
```
2. Configure `.env` with your credentials
3. Run the bot:
```bash
node bin/zcode.js --bot
```
4. Open Telegram and start chatting!
## 📝 License
MIT
## 🤝 Contributing
Contributions welcome! This is based on:
- [better-clawd](https://github.com/x1xhlol/better-clawd.git) - Claude Code clone
- [Hermes Agent](https://hermes-agent.nousresearch.com) - Our AI assistant
---
Built with ❤️ by zCode CLI X