@wu529778790/open-im 0.1.0 → 0.1.1

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 +58 -33
  2. package/dist/cli.js +31 -4
  3. package/package.json +4 -2
package/README.md CHANGED
@@ -1,51 +1,76 @@
1
1
  # open-im
2
2
 
3
- 多平台 IM 桥接,支持多种 AI CLI 工具(Claude Code、Codex、Cursor 等)。
3
+ > 🚀 把你的 AI 助手装进口袋里 - 在 Telegram 随时随地使用 Claude Code
4
4
 
5
- ## 功能
5
+ 还在受限于终端吗?用手机也能 Coding 了!
6
6
 
7
- - **多 AI 工具**:通过 `AI_COMMAND` 配置切换 Claude / Codex / Cursor
8
- - **流式输出**:节流更新,Telegram editMessage 实时展示
9
- - **会话管理**:每用户独立 session,`/new` 重置
10
- - **命令**:`/help` `/new` `/cd` `/pwd` `/status`
7
+ open-im 是一个轻量级的 IM 桥接工具,让你通过 Telegram 就能使用 Claude Code、Codex、Cursor AI CLI 工具。无论是在咖啡厅、地铁上,还是躺在床上,你的 AI 助手随时在线。
11
8
 
12
- ## 快速开始
9
+ ## ✨ 为什么选择 open-im
13
10
 
14
- ### 快速开始
11
+ - **📱 移动友好** - 告别终端,用手机照样写代码
12
+ - **⚡ 实时流式输出** - AI 思考过程实时可见,像在终端一样流畅
13
+ - **🔒 安全可控** - 支持白名单,只有你能用
14
+ - **🔄 独立会话** - 每个人独立 session,互不干扰
15
+ - **🛠️ 多 AI 支持** - Claude / Codex / Cursor 随意切换
16
+
17
+ ## 🚀 快速开始
18
+
19
+ ### 方式一:npx(无需安装)
20
+
21
+ ```bash
22
+ npx @wu529778790/open-im start
23
+ ```
24
+
25
+ ### 方式二:全局安装(推荐常用用户)
15
26
 
16
27
  ```bash
17
- npm run build
18
- npm run dev # 或 npm start
28
+ npm i @wu529778790/open-im -g
29
+ open-im start
19
30
  ```
20
31
 
21
- 首次运行会进入交互式配置,按提示输入后自动启动服务。配置保存到 `~/.open-im/config.json`。
32
+ 首次运行会引导你完成配置,30 秒即可搞定。
22
33
 
23
- ## 配置
34
+ ## 📖 常用命令
24
35
 
25
- | 变量 | 说明 |
36
+ | 命令 | 说明 |
26
37
  |------|------|
27
- | `TELEGRAM_BOT_TOKEN` | Telegram Bot Token |
28
- | `ALLOWED_USER_IDS` | 白名单用户 ID(逗号分隔,空=所有人) |
29
- | `AI_COMMAND` | `claude` \| `codex` \| `cursor`,默认 `claude` |
30
- | `CLAUDE_CLI_PATH` | Claude CLI 路径,默认 `claude` |
31
- | `CLAUDE_WORK_DIR` | 工作目录 |
32
- | `CLAUDE_SKIP_PERMISSIONS` | 跳过权限确认,默认 `true` |
38
+ | `open-im start` | 启动服务(后台运行) |
39
+ | `open-im stop` | 停止服务 |
33
40
 
34
- ## 项目结构
41
+ ### Telegram 机器人命令
35
42
 
36
- ```
37
- src/
38
- ├── adapters/ # ToolAdapter 抽象与实现
39
- │ ├── tool-adapter.interface.ts
40
- │ ├── claude-adapter.ts
41
- │ └── registry.ts
42
- ├── claude/ # Claude CLI 运行与解析
43
- ├── shared/ # ai-task、utils、types
44
- ├── telegram/ # Telegram 事件与消息
45
- ├── session/ # 会话管理
46
- └── commands/ # 命令分发
43
+ | 命令 | 功能 |
44
+ |------|------|
45
+ | `/help` | 查看帮助 |
46
+ | `/new` | 开启新会话 |
47
+ | `/cd <路径>` | 切换工作目录 |
48
+ | `/pwd` | 查看当前目录 |
49
+ | `/status` | 查看运行状态 |
50
+
51
+ ## 💡 使用场景
52
+
53
+ - 🚇 **通勤路上** - 用手机处理简单的代码问题
54
+ - ☕ **咖啡厅** - 没带电脑也能快速调试
55
+ - 🛋️ **沙发模式** - 躺着看 AI 帮你写代码
56
+ - 🌙 **紧急修复** - 半夜收到报警,手机直接处理
57
+
58
+ ## 📦 安装方式
59
+
60
+ ```bash
61
+ # npx(无需安装)
62
+ npx @wu529778790/open-im start
63
+
64
+ # npm 全局安装
65
+ npm i @wu529778790/open-im -g
66
+
67
+ # yarn 全局安装
68
+ yarn global add @wu529778790/open-im
69
+
70
+ # pnpm 全局安装
71
+ pnpm i @wu529778790/open-im -g
47
72
  ```
48
73
 
49
- ## License
74
+ ## 📝 License
50
75
 
51
- MIT
76
+ [MIT](LICENSE)
package/dist/cli.js CHANGED
@@ -1,6 +1,33 @@
1
1
  #!/usr/bin/env node
2
2
  import { main } from './index.js';
3
- main().catch((err) => {
4
- console.error(err);
5
- process.exit(1);
6
- });
3
+ import { exec } from 'node:child_process';
4
+ const args = process.argv.slice(2);
5
+ if (args[0] === 'stop') {
6
+ exec("pkill -f 'node dist/index.js'", (err) => {
7
+ if (err) {
8
+ console.log('未找到运行中的服务');
9
+ }
10
+ else {
11
+ console.log('服务已停止');
12
+ }
13
+ });
14
+ }
15
+ else if (args[0] === 'start') {
16
+ // 后台启动
17
+ exec('node dist/index.js &', (err) => {
18
+ if (err) {
19
+ console.error('启动失败:', err);
20
+ process.exit(1);
21
+ }
22
+ else {
23
+ console.log('服务已在后台启动');
24
+ }
25
+ });
26
+ }
27
+ else {
28
+ // 默认启动(兼容直接运行 open-im)
29
+ main().catch((err) => {
30
+ console.error(err);
31
+ process.exit(1);
32
+ });
33
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wu529778790/open-im",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Multi-platform IM bridge for AI CLI tools (Claude, Codex, Cursor)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -14,7 +14,9 @@
14
14
  "scripts": {
15
15
  "build": "tsc",
16
16
  "dev": "tsx src/index.ts",
17
- "start": "node dist/index.js",
17
+ "run": "node dist/index.js",
18
+ "start": "node dist/index.js &",
19
+ "stop": "pkill -f 'node dist/index.js'",
18
20
  "setup": "node dist/index.js --setup-only",
19
21
  "prepublishOnly": "npm run build"
20
22
  },