codeclaw 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +374 -0
- package/bin/codeclaw.js +3 -0
- package/package.json +40 -0
- package/src/channel-telegram.js +1070 -0
- package/src/codeclaw.js +781 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 codeclaw contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# codeclaw
|
|
4
|
+
|
|
5
|
+
**The best IM-driven remote coding experience. Period.**
|
|
6
|
+
|
|
7
|
+
IM 交互体验最好的远程编程工具。没有之一。
|
|
8
|
+
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](https://nodejs.org)
|
|
11
|
+
[]()
|
|
12
|
+
[](https://www.npmjs.com/package/codeclaw)
|
|
13
|
+
|
|
14
|
+
[English](#english) | [中文](#中文)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
<a id="english"></a>
|
|
21
|
+
|
|
22
|
+
## Why codeclaw?
|
|
23
|
+
|
|
24
|
+
Most "AI + IM" bridges just forward messages. codeclaw is built from scratch for **the best possible remote coding experience over instant messaging**:
|
|
25
|
+
|
|
26
|
+
- **Real-time streaming** — token-by-token output via Telegram message edits; you see the AI thinking live, not a wall of text after 2 minutes
|
|
27
|
+
- **System-level keep-alive** — triggers OS-level power assertions to prevent your laptop from sleeping, so long-running tasks finish even when you walk away
|
|
28
|
+
- **Dual engine hot-switch** — Claude Code + Codex CLI, switch with a single command
|
|
29
|
+
- **Battle mode** — run both engines in parallel on the same prompt, compare side-by-side
|
|
30
|
+
- **True multi-session** — named sessions with persistent thread IDs; restart codeclaw, resume exactly where you left off
|
|
31
|
+
- **Zero dependencies, one command** — pure Node.js stdlib, `npx codeclaw` and you're running
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Telegram (your phone / desktop)
|
|
35
|
+
↕ long poll
|
|
36
|
+
codeclaw (your machine, your project dir)
|
|
37
|
+
↕ subprocess
|
|
38
|
+
claude / codex CLI
|
|
39
|
+
↕ reads & writes
|
|
40
|
+
your codebase
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
No server. No Docker. No config files. Just one process bridging Telegram to your local AI agent.
|
|
44
|
+
|
|
45
|
+
## Comparison with Alternatives
|
|
46
|
+
|
|
47
|
+
### vs. Claude Code + Telegram Projects
|
|
48
|
+
|
|
49
|
+
| Feature | codeclaw | claude-code-telegram | claudecode-telegram | claude-telegram-bot-bridge | ccbot | claudegram |
|
|
50
|
+
|---------|----------|---------------------|--------------------|-----------------------------|-------|------------|
|
|
51
|
+
| Streaming output (live edits) | **Yes** | Yes | Partial | Partial | No | No |
|
|
52
|
+
| Dual engine (Claude + Codex) | **Yes** | No | No | No | No | No |
|
|
53
|
+
| Battle mode (parallel compare) | **Yes** | No | No | No | No | No |
|
|
54
|
+
| Multi-session management | **Yes** | Yes | No | No | Partial (tmux) | No |
|
|
55
|
+
| Session persistence (resume after restart) | **Yes** | Yes | No | No | Partial | No |
|
|
56
|
+
| Keep-alive (prevent system sleep) | **Yes** | No | No | No | No | No |
|
|
57
|
+
| Zero dependencies | **Yes** | No | No | No | No (tmux) | No |
|
|
58
|
+
| npx one-command start | **Yes** | No | No | No | No | No |
|
|
59
|
+
| Image/photo input support | **Yes** | Partial | No | No | No | No |
|
|
60
|
+
| Paginated long output | **Yes** | No | No | No | N/A | No |
|
|
61
|
+
| Access control (user/chat whitelist) | **Yes** | Partial | No | No | No | No |
|
|
62
|
+
|
|
63
|
+
### vs. Multi-IM / Multi-Engine Platforms
|
|
64
|
+
|
|
65
|
+
| Feature | codeclaw | cc-connect | OpenClaw | Claude-to-IM-skill | heyagent |
|
|
66
|
+
|---------|----------|------------|----------|---------------------|----------|
|
|
67
|
+
| IM platforms | Telegram | Telegram, Slack, Discord, 飞书, 钉钉, LINE, 企业微信 | 20+ (Telegram, WhatsApp, Slack, Discord, Signal, iMessage...) | Telegram, Discord, 飞书 | Telegram |
|
|
68
|
+
| AI engines | Claude Code, Codex | Claude Code, Codex, Gemini, Cursor | Claude, Codex, local LLM | Claude Code, Codex | Claude Code, Codex |
|
|
69
|
+
| Streaming (live token output) | **Yes** | Partial | Partial | No | No |
|
|
70
|
+
| Battle mode | **Yes** | No | No | No | No |
|
|
71
|
+
| Keep-alive (prevent sleep) | **Yes** | No | No | No | No |
|
|
72
|
+
| Zero dependencies | **Yes** | No | No | No | No |
|
|
73
|
+
| Setup time | **~10 seconds** | Minutes | Minutes | Minutes | Minutes |
|
|
74
|
+
| Config files needed | **0** | YAML | YAML + plugins | Config | Config |
|
|
75
|
+
|
|
76
|
+
> **Our philosophy:** codeclaw intentionally focuses on **one IM channel done right** rather than many done poorly. If you need 20 IM platforms, use OpenClaw or cc-connect. If you want **the best Telegram remote coding experience** — the fastest streaming, the smoothest interaction, and zero setup friction — use codeclaw.
|
|
77
|
+
|
|
78
|
+
### Keep-Alive: Your Laptop Stays Awake
|
|
79
|
+
|
|
80
|
+
When codeclaw is running, it triggers **OS-level power assertions** to prevent your machine from sleeping. This means:
|
|
81
|
+
|
|
82
|
+
- Long-running AI tasks (refactoring, large codegen, test suites) **complete reliably** even if you walk away from the keyboard
|
|
83
|
+
- No more coming back to find your screen locked, SSH session dropped, or AI agent frozen mid-task due to idle sleep
|
|
84
|
+
- Works on **macOS** (caffeinate) and **Linux** (systemd-inhibit)
|
|
85
|
+
|
|
86
|
+
This is a critical feature for remote coding — you send a task from your phone, the laptop stays awake and keeps working. (Note: closing the lid on most laptops will still trigger hardware-level sleep — keep the lid open for best results.)
|
|
87
|
+
|
|
88
|
+
## Features
|
|
89
|
+
|
|
90
|
+
- **Dual engine** — Claude Code + Codex CLI, hot-switch with `/engine`
|
|
91
|
+
- **Streaming** — real-time token-by-token output via Telegram message edits
|
|
92
|
+
- **Battle mode** — `/battle <prompt>` runs both engines in parallel, compare side-by-side
|
|
93
|
+
- **Multi-session** — per-chat session management with named sessions and thread resume
|
|
94
|
+
- **Keep-alive** — OS-level sleep prevention ensures long tasks complete uninterrupted
|
|
95
|
+
- **Full access / safe mode** — let the agent run freely, or lock it down
|
|
96
|
+
- **Zero dependencies** — pure Node.js stdlib, no npm install needed
|
|
97
|
+
- **Image input** — send photos to the bot for visual context (screenshots, diagrams)
|
|
98
|
+
- **Paginated output** — long responses are split into navigable pages with inline buttons
|
|
99
|
+
- **Auto-start notice** — sends online status to all known chats on startup
|
|
100
|
+
- **Access control** — restrict by chat/user ID whitelist
|
|
101
|
+
|
|
102
|
+
## Quick Start
|
|
103
|
+
|
|
104
|
+
### Using npx (recommended)
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
cd your-project/
|
|
108
|
+
npx codeclaw -t YOUR_BOT_TOKEN
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Global install
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npm install -g codeclaw
|
|
115
|
+
cd your-project/
|
|
116
|
+
codeclaw -t YOUR_BOT_TOKEN
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
> **Prerequisites:** Node.js 18+, `claude` CLI and/or `codex` CLI in PATH, a Telegram Bot Token from [@BotFather](https://t.me/BotFather).
|
|
120
|
+
|
|
121
|
+
## CLI Options
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
codeclaw [options]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Core
|
|
128
|
+
|
|
129
|
+
| Flag | Env | Default | Description |
|
|
130
|
+
|------|-----|---------|-------------|
|
|
131
|
+
| `-c, --channel` | `CODECLAW_CHANNEL` | `telegram` | IM channel |
|
|
132
|
+
| `-t, --token` | `CODECLAW_TOKEN` | — | Bot token |
|
|
133
|
+
| `-e, --engine` | `DEFAULT_ENGINE` | `claude` | AI engine: `claude` or `codex` |
|
|
134
|
+
| `-w, --workdir` | `CODECLAW_WORKDIR` | `.` | Working directory |
|
|
135
|
+
| `-m, --model` | `CLAUDE_MODEL` / `CODEX_MODEL` | — | Model override |
|
|
136
|
+
|
|
137
|
+
### Access Control
|
|
138
|
+
|
|
139
|
+
| Flag | Env | Default | Description |
|
|
140
|
+
|------|-----|---------|-------------|
|
|
141
|
+
| `--full-access` | `CODECLAW_FULL_ACCESS` | `true` | Agent can read/write/execute without confirmation |
|
|
142
|
+
| `--safe-mode` | `CODECLAW_SAFE_MODE` | `false` | Agent asks before destructive operations |
|
|
143
|
+
| `--allowed-ids` | `CODECLAW_ALLOWED_IDS` | — | Comma-separated user/chat IDs whitelist |
|
|
144
|
+
| `--timeout` | `CODECLAW_TIMEOUT` | `300` | Max seconds per request |
|
|
145
|
+
|
|
146
|
+
### Engine-specific
|
|
147
|
+
|
|
148
|
+
| Env | Description |
|
|
149
|
+
|-----|-------------|
|
|
150
|
+
| `CLAUDE_MODEL` | Claude model (e.g. `sonnet`, `opus`) |
|
|
151
|
+
| `CLAUDE_PERMISSION_MODE` | `bypassPermissions` (default) or `default` |
|
|
152
|
+
| `CLAUDE_EXTRA_ARGS` | Extra CLI args passed to `claude` |
|
|
153
|
+
| `CODEX_MODEL` | Codex model (e.g. `o3`, `o4-mini`) |
|
|
154
|
+
| `CODEX_REASONING_EFFORT` | `none` / `minimal` / `low` / `medium` / `high` / `xhigh` |
|
|
155
|
+
| `CODEX_EXTRA_ARGS` | Extra CLI args passed to `codex` |
|
|
156
|
+
|
|
157
|
+
### Examples
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Basic: Telegram + Claude Code, full access
|
|
161
|
+
npx codeclaw -t $BOT_TOKEN
|
|
162
|
+
|
|
163
|
+
# Codex engine, safe mode, restricted users
|
|
164
|
+
npx codeclaw -t $BOT_TOKEN -e codex --safe-mode --allowed-ids 123456,789012
|
|
165
|
+
|
|
166
|
+
# Custom model, custom working directory
|
|
167
|
+
npx codeclaw -t $BOT_TOKEN -m sonnet -w ~/projects/my-app
|
|
168
|
+
|
|
169
|
+
# Validate setup without starting
|
|
170
|
+
npx codeclaw -t $BOT_TOKEN --self-check
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Bot Commands
|
|
174
|
+
|
|
175
|
+
| Command | Description |
|
|
176
|
+
|---------|-------------|
|
|
177
|
+
| `/ask <prompt>` | Ask the AI agent |
|
|
178
|
+
| `/engine [codex\|claude]` | Show or switch engine |
|
|
179
|
+
| `/battle <prompt>` | Run both engines, compare results |
|
|
180
|
+
| `/new [prompt]` | Reset session (optionally start new one) |
|
|
181
|
+
| `/session list\|use\|new\|del` | Multi-session management |
|
|
182
|
+
| `/status` | Show current session / engine / thread info |
|
|
183
|
+
| `/stop` | Clear current session thread |
|
|
184
|
+
| `/clear [N]` | Delete bot's recent messages (default 50) |
|
|
185
|
+
| `/help` | Show all commands |
|
|
186
|
+
|
|
187
|
+
> In private/DM chats, just send text directly — no command prefix needed.
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
[MIT](LICENSE)
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
<a id="中文"></a>
|
|
196
|
+
|
|
197
|
+
<div align="center">
|
|
198
|
+
|
|
199
|
+
# codeclaw
|
|
200
|
+
|
|
201
|
+
**IM 交互体验最好的远程编程工具。没有之一。**
|
|
202
|
+
|
|
203
|
+
</div>
|
|
204
|
+
|
|
205
|
+
## 为什么选 codeclaw?
|
|
206
|
+
|
|
207
|
+
大多数「AI + IM」桥接工具只是转发消息。codeclaw 从零开始为 **即时通讯上最好的远程编程体验** 而构建:
|
|
208
|
+
|
|
209
|
+
- **实时流式输出** — 通过 Telegram 消息编辑逐 token 推送;你能实时看到 AI 的思考过程,而不是等 2 分钟后收到一大段文字
|
|
210
|
+
- **系统级保活** — 触发操作系统级电源断言,防止笔记本休眠,确保长时间任务在你离开后依然完整执行
|
|
211
|
+
- **双引擎热切换** — Claude Code + Codex CLI,一条命令即可切换
|
|
212
|
+
- **对战模式** — 同一个 prompt 同时跑两个引擎,结果并排对比
|
|
213
|
+
- **真正的多会话** — 命名会话 + 持久化线程 ID;重启 codeclaw 后可以无缝恢复之前的对话
|
|
214
|
+
- **零依赖、一条命令** — 纯 Node.js 标准库,`npx codeclaw` 即可运行
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
Telegram(手机 / 桌面端)
|
|
218
|
+
↕ 长轮询
|
|
219
|
+
codeclaw(你的机器,你的项目目录)
|
|
220
|
+
↕ 子进程
|
|
221
|
+
claude / codex CLI
|
|
222
|
+
↕ 读写
|
|
223
|
+
你的代码库
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
不需要服务器,不需要 Docker,不需要配置文件。一个进程把 Telegram 桥接到你本地的 AI 编程助手。
|
|
227
|
+
|
|
228
|
+
## 竞品对比
|
|
229
|
+
|
|
230
|
+
### vs. Claude Code + Telegram 专项工具
|
|
231
|
+
|
|
232
|
+
| 特性 | codeclaw | claude-code-telegram | claudecode-telegram | claude-telegram-bot-bridge | ccbot | claudegram |
|
|
233
|
+
|------|----------|---------------------|--------------------|-----------------------------|-------|------------|
|
|
234
|
+
| 流式输出(实时编辑) | **支持** | 支持 | 部分 | 部分 | 不支持 | 不支持 |
|
|
235
|
+
| 双引擎(Claude + Codex) | **支持** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 |
|
|
236
|
+
| 对战模式(并行对比) | **支持** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 |
|
|
237
|
+
| 多会话管理 | **支持** | 支持 | 不支持 | 不支持 | 部分(tmux) | 不支持 |
|
|
238
|
+
| 会话持久化(重启恢复) | **支持** | 支持 | 不支持 | 不支持 | 部分 | 不支持 |
|
|
239
|
+
| 保活(防止系统休眠) | **支持** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 |
|
|
240
|
+
| 零依赖 | **是** | 否(Node.js) | 否 | 否 | 否(tmux) | 否 |
|
|
241
|
+
| npx 一键启动 | **是** | 否 | 否 | 否 | 否 | 否 |
|
|
242
|
+
| 图片输入支持 | **支持** | 部分 | 不支持 | 不支持 | 不支持 | 不支持 |
|
|
243
|
+
| 长文本分页 | **支持** | 不支持 | 不支持 | 不支持 | N/A | 不支持 |
|
|
244
|
+
| 访问控制(白名单) | **支持** | 部分 | 不支持 | 不支持 | 不支持 | 不支持 |
|
|
245
|
+
|
|
246
|
+
### vs. 多 IM / 多引擎平台
|
|
247
|
+
|
|
248
|
+
| 特性 | codeclaw | cc-connect | OpenClaw | Claude-to-IM-skill | heyagent |
|
|
249
|
+
|------|----------|------------|----------|---------------------|----------|
|
|
250
|
+
| IM 平台 | Telegram | Telegram、Slack、Discord、飞书、钉钉、LINE、企业微信 | 20+(Telegram、WhatsApp、Slack、Discord、Signal、iMessage…) | Telegram、Discord、飞书 | Telegram |
|
|
251
|
+
| AI 引擎 | Claude Code、Codex | Claude Code、Codex、Gemini、Cursor | Claude、Codex、本地 LLM | Claude Code、Codex | Claude Code、Codex |
|
|
252
|
+
| 流式输出(实时 token) | **支持** | 部分 | 部分 | 不支持 | 不支持 |
|
|
253
|
+
| 对战模式 | **支持** | 不支持 | 不支持 | 不支持 | 不支持 |
|
|
254
|
+
| 保活(防休眠) | **支持** | 不支持 | 不支持 | 不支持 | 不支持 |
|
|
255
|
+
| 零依赖 | **是** | 否 | 否 | 否 | 否 |
|
|
256
|
+
| 部署时间 | **约 10 秒** | 数分钟 | 数分钟 | 数分钟 | 数分钟 |
|
|
257
|
+
| 需要配置文件 | **0 个** | YAML | YAML + 插件 | 配置文件 | 配置文件 |
|
|
258
|
+
|
|
259
|
+
> **我们的理念:** codeclaw 有意专注于 **把一个 IM 渠道做到极致**,而非什么都做但都做不好。如果你需要 20 个 IM 平台,用 OpenClaw 或 cc-connect。如果你想要 **最好的 Telegram 远程编程体验** —— 最快的流式输出、最流畅的交互、零配置摩擦 —— 用 codeclaw。
|
|
260
|
+
|
|
261
|
+
### 保活:你的笔记本始终亮屏
|
|
262
|
+
|
|
263
|
+
codeclaw 运行时会触发 **操作系统级电源断言**,防止你的机器进入休眠。这意味着:
|
|
264
|
+
|
|
265
|
+
- 长时间 AI 任务(重构、大量代码生成、测试套件)即使你 **离开键盘** 也能可靠完成
|
|
266
|
+
- 不再出现回来发现屏幕锁定、SSH 断开、AI 跑到一半因空闲休眠而卡住的情况
|
|
267
|
+
- 支持 **macOS**(caffeinate)和 **Linux**(systemd-inhibit)
|
|
268
|
+
|
|
269
|
+
这是远程编程的关键功能 —— 你从手机上发一个任务,笔记本保持唤醒状态持续工作。(注意:合上盖子在大多数笔记本上仍会触发硬件级休眠,建议保持开盖。)
|
|
270
|
+
|
|
271
|
+
## 功能特性
|
|
272
|
+
|
|
273
|
+
- **双引擎** — Claude Code + Codex CLI,用 `/engine` 命令热切换
|
|
274
|
+
- **流式输出** — 通过 Telegram 消息编辑实时逐 token 输出
|
|
275
|
+
- **对战模式** — `/battle <prompt>` 同时运行两个引擎,结果并排对比
|
|
276
|
+
- **多会话** — 每个聊天支持命名会话管理和线程恢复
|
|
277
|
+
- **系统保活** — 操作系统级防休眠,确保长任务不中断
|
|
278
|
+
- **完全访问 / 安全模式** — 让 AI 自由运行,或限制危险操作需确认
|
|
279
|
+
- **零依赖** — 纯 Node.js 标准库,无需 npm install
|
|
280
|
+
- **图片输入** — 向机器人发送图片提供视觉上下文(截图、设计图)
|
|
281
|
+
- **长文本分页** — 长回复自动分页,内联按钮翻页浏览
|
|
282
|
+
- **启动通知** — 启动时向所有已知聊天发送在线状态
|
|
283
|
+
- **访问控制** — 按聊天/用户 ID 白名单限制
|
|
284
|
+
|
|
285
|
+
## 快速开始
|
|
286
|
+
|
|
287
|
+
### 使用 npx(推荐)
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
cd your-project/
|
|
291
|
+
npx codeclaw -t YOUR_BOT_TOKEN
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### 全局安装
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
npm install -g codeclaw
|
|
298
|
+
cd your-project/
|
|
299
|
+
codeclaw -t YOUR_BOT_TOKEN
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
> **前置条件:** Node.js 18+,`claude` CLI 和/或 `codex` CLI 在 PATH 中,从 [@BotFather](https://t.me/BotFather) 获取 Telegram Bot Token。
|
|
303
|
+
|
|
304
|
+
## 命令行选项
|
|
305
|
+
|
|
306
|
+
```
|
|
307
|
+
codeclaw [选项]
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### 核心参数
|
|
311
|
+
|
|
312
|
+
| 参数 | 环境变量 | 默认值 | 说明 |
|
|
313
|
+
|------|---------|--------|------|
|
|
314
|
+
| `-c, --channel` | `CODECLAW_CHANNEL` | `telegram` | IM 渠道 |
|
|
315
|
+
| `-t, --token` | `CODECLAW_TOKEN` | — | Bot token |
|
|
316
|
+
| `-e, --engine` | `DEFAULT_ENGINE` | `claude` | AI 引擎:`claude` 或 `codex` |
|
|
317
|
+
| `-w, --workdir` | `CODECLAW_WORKDIR` | `.` | 工作目录 |
|
|
318
|
+
| `-m, --model` | `CLAUDE_MODEL` / `CODEX_MODEL` | — | 模型覆盖 |
|
|
319
|
+
|
|
320
|
+
### 访问控制
|
|
321
|
+
|
|
322
|
+
| 参数 | 环境变量 | 默认值 | 说明 |
|
|
323
|
+
|------|---------|--------|------|
|
|
324
|
+
| `--full-access` | `CODECLAW_FULL_ACCESS` | `true` | AI 可以无需确认地读写执行 |
|
|
325
|
+
| `--safe-mode` | `CODECLAW_SAFE_MODE` | `false` | AI 在执行危险操作前需确认 |
|
|
326
|
+
| `--allowed-ids` | `CODECLAW_ALLOWED_IDS` | — | 允许交互的用户/聊天 ID,逗号分隔 |
|
|
327
|
+
| `--timeout` | `CODECLAW_TIMEOUT` | `300` | 每次请求最大秒数 |
|
|
328
|
+
|
|
329
|
+
### 引擎专属配置
|
|
330
|
+
|
|
331
|
+
| 环境变量 | 说明 |
|
|
332
|
+
|---------|------|
|
|
333
|
+
| `CLAUDE_MODEL` | Claude 模型(如 `sonnet`、`opus`) |
|
|
334
|
+
| `CLAUDE_PERMISSION_MODE` | `bypassPermissions`(默认)或 `default` |
|
|
335
|
+
| `CLAUDE_EXTRA_ARGS` | 传递给 `claude` CLI 的额外参数 |
|
|
336
|
+
| `CODEX_MODEL` | Codex 模型(如 `o3`、`o4-mini`) |
|
|
337
|
+
| `CODEX_REASONING_EFFORT` | `none` / `minimal` / `low` / `medium` / `high` / `xhigh` |
|
|
338
|
+
| `CODEX_EXTRA_ARGS` | 传递给 `codex` CLI 的额外参数 |
|
|
339
|
+
|
|
340
|
+
### 使用示例
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
# 基本用法:Telegram + Claude Code,完全访问
|
|
344
|
+
npx codeclaw -t $BOT_TOKEN
|
|
345
|
+
|
|
346
|
+
# Codex 引擎,安全模式,限制用户
|
|
347
|
+
npx codeclaw -t $BOT_TOKEN -e codex --safe-mode --allowed-ids 123456,789012
|
|
348
|
+
|
|
349
|
+
# 自定义模型和工作目录
|
|
350
|
+
npx codeclaw -t $BOT_TOKEN -m sonnet -w ~/projects/my-app
|
|
351
|
+
|
|
352
|
+
# 验证配置(不启动)
|
|
353
|
+
npx codeclaw -t $BOT_TOKEN --self-check
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
## 机器人命令
|
|
357
|
+
|
|
358
|
+
| 命令 | 说明 |
|
|
359
|
+
|------|------|
|
|
360
|
+
| `/ask <prompt>` | 向 AI 提问 |
|
|
361
|
+
| `/engine [codex\|claude]` | 查看或切换引擎 |
|
|
362
|
+
| `/battle <prompt>` | 同时运行两个引擎,对比结果 |
|
|
363
|
+
| `/new [prompt]` | 重置会话(可选带 prompt 开始新对话) |
|
|
364
|
+
| `/session list\|use\|new\|del` | 多会话管理 |
|
|
365
|
+
| `/status` | 查看当前会话/引擎/线程信息 |
|
|
366
|
+
| `/stop` | 清除当前会话线程 |
|
|
367
|
+
| `/clear [N]` | 删除机器人最近的消息(默认 50 条) |
|
|
368
|
+
| `/help` | 显示所有命令 |
|
|
369
|
+
|
|
370
|
+
> 在私聊中直接发送文字即可,无需命令前缀。
|
|
371
|
+
|
|
372
|
+
## 许可证
|
|
373
|
+
|
|
374
|
+
[MIT](LICENSE)
|
package/bin/codeclaw.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "codeclaw",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The best IM-driven remote coding experience. Bridge AI coding agents to any IM.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"codeclaw": "bin/codeclaw.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"src/",
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"telegram",
|
|
17
|
+
"ai",
|
|
18
|
+
"coding",
|
|
19
|
+
"claude",
|
|
20
|
+
"codex",
|
|
21
|
+
"bridge",
|
|
22
|
+
"cli"
|
|
23
|
+
],
|
|
24
|
+
"author": "xiaotonng",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/xiaotonng/codeclaw.git"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"test:watch": "vitest"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=18.0.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"vitest": "^4.0.18"
|
|
39
|
+
}
|
|
40
|
+
}
|