@emqo/claudebridge 0.1.0 → 0.1.2

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.
Files changed (3) hide show
  1. package/README.md +33 -9
  2. package/dist/cli.js +4 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -29,19 +29,27 @@ Bridge the `claude` CLI to chat platforms (Telegram, Discord). Spawns `claude` a
29
29
 
30
30
  ## Quick Start
31
31
 
32
+ ### Global Install (npm)
33
+
32
34
  ```bash
33
- # Install
34
- npm install
35
+ npm i -g @emqo/claudebridge
36
+ claudebridge init # generate config.yaml from template
37
+ # edit config.yaml — set endpoints, tokens, whitelist
38
+ claudebridge start # foreground
39
+ claudebridge start --daemon # background
40
+ claudebridge status # check if running
41
+ claudebridge reload # hot reload config
42
+ claudebridge stop # stop daemon
43
+ ```
35
44
 
36
- # Configure
37
- cp config.yaml.example config.yaml # or edit config.yaml directly
38
- # Set your endpoints, tokens, and access whitelist
45
+ ### From Source
39
46
 
40
- # Build & run
47
+ ```bash
48
+ npm install
49
+ cp config.yaml.example config.yaml
41
50
  npm run build
42
51
  npm start
43
-
44
- # Or dev mode (hot reload)
52
+ # or dev mode
45
53
  npm run dev
46
54
  ```
47
55
 
@@ -134,6 +142,7 @@ Regex matches first (instant, free). If no match and `use_claude_fallback` is en
134
142
  ## Architecture
135
143
 
136
144
  ```
145
+ src/cli.ts CLI entry: start/stop/status/reload/init, PID management
137
146
  src/index.ts Entry point, config loading, hot reload
138
147
  src/core/
139
148
  agent.ts Claude CLI subprocess spawner with retry & rotation
@@ -188,9 +197,24 @@ MIT
188
197
 
189
198
  ## 快速开始
190
199
 
200
+ ### 全局安装(npm)
201
+
191
202
  ```bash
192
- npm install
203
+ npm i -g @emqo/claudebridge
204
+ claudebridge init # 从模板生成 config.yaml
193
205
  # 编辑 config.yaml,配置端点、Token、白名单
206
+ claudebridge start # 前台启动
207
+ claudebridge start --daemon # 后台启动
208
+ claudebridge status # 查看运行状态
209
+ claudebridge reload # 热重载配置
210
+ claudebridge stop # 停止进程
211
+ ```
212
+
213
+ ### 从源码
214
+
215
+ ```bash
216
+ npm install
217
+ cp config.yaml.example config.yaml
194
218
  npm run build && npm start
195
219
  # 或开发模式
196
220
  npm run dev
package/dist/cli.js CHANGED
@@ -28,6 +28,10 @@ function removePid() { try {
28
28
  }
29
29
  catch { } }
30
30
  const args = process.argv.slice(2);
31
+ if (args.includes("--help") || args.includes("-h")) {
32
+ console.log("Usage: claudebridge <start|stop|status|reload|init> [--config path] [--daemon|-d]");
33
+ process.exit(0);
34
+ }
31
35
  const cmd = args.find(a => !a.startsWith("-")) || "start";
32
36
  const cfgIdx = args.indexOf("--config");
33
37
  const cfgPath = cfgIdx !== -1 ? args[cfgIdx + 1] : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emqo/claudebridge",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Bridge Claude Code Agent SDK to chat platforms (Telegram, Discord, etc.)",
5
5
  "main": "dist/index.js",
6
6
  "bin": {