claude-telegram-bot 0.3.0 → 0.3.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.
package/README.ko.md CHANGED
@@ -68,11 +68,10 @@ OpenClaw처럼 웹 UI까지 갖춘 구성을 써봤다면, 이 프로젝트는
68
68
  **npx로 바로 실행**
69
69
 
70
70
  ```sh
71
- npx claude-telegram-bot init # 현재 폴더에 config.json 생성
72
- npx claude-telegram-bot init mybot.json # 파일명 직접 지정도 가능
71
+ npx claude-telegram-bot init # 현재 폴더에 mybot.json 생성
72
+ npx claude-telegram-bot init myapp.json # 파일명 직접 지정도 가능
73
73
  # 설정 편집 (token, projectDir 등)
74
- npx claude-telegram-bot # config.json 으로 실행
75
- npx claude-telegram-bot mybot.json # 또는 경로를 직접 전달
74
+ npx claude-telegram-bot # mybot.json 으로 실행 (없으면 config.json 폴백)
76
75
  ```
77
76
 
78
77
  **전역 설치 (상시 가동에 권장)**
@@ -80,8 +79,8 @@ npx claude-telegram-bot mybot.json # 또는 경로를 직접 전달
80
79
  ```sh
81
80
  npm i -g claude-telegram-bot
82
81
 
83
- claude-telegram-bot init ~/botconfigs/myproj # config.json 생성
84
- claude-telegram-bot init ~/botconfigs/myproj/mybot.json # 또는 파일명 지정
82
+ claude-telegram-bot init ~/botconfigs/myproj # mybot.json 생성
83
+ claude-telegram-bot init ~/botconfigs/myproj/myapp.json # 또는 파일명 지정
85
84
  # 설정 편집
86
85
  claude-telegram-bot ~/botconfigs/myproj/mybot.json
87
86
  ```
@@ -90,7 +89,7 @@ claude-telegram-bot ~/botconfigs/myproj/mybot.json
90
89
 
91
90
  ## 설정
92
91
 
93
- `config.json`의 키는 다음과 같습니다.
92
+ `mybot.json`(또는 사용 중인 config 파일)의 키는 다음과 같습니다.
94
93
 
95
94
  | 키 | 설명 |
96
95
  |---|---|
package/README.md CHANGED
@@ -118,11 +118,10 @@ Prerequisites: **Node 18+** and the **`claude` CLI installed and authenticated**
118
118
  **Option A — npx (no install)**
119
119
 
120
120
  ```sh
121
- npx claude-telegram-bot init # writes ./config.json
122
- npx claude-telegram-bot init mybot.json # or pick your own filename
121
+ npx claude-telegram-bot init # writes ./mybot.json
122
+ npx claude-telegram-bot init myapp.json # or pick your own filename
123
123
  # edit the config (token, projectDir, …)
124
- npx claude-telegram-bot # runs ./config.json
125
- npx claude-telegram-bot mybot.json # or pass the path directly
124
+ npx claude-telegram-bot # runs ./mybot.json (falls back to config.json)
126
125
  ```
127
126
 
128
127
  **Option B — global install (recommended for an always-on daemon)**
@@ -130,8 +129,8 @@ npx claude-telegram-bot mybot.json # or pass the path directly
130
129
  ```sh
131
130
  npm i -g claude-telegram-bot
132
131
 
133
- claude-telegram-bot init ~/botconfigs/myproj # writes ~/botconfigs/myproj/config.json
134
- claude-telegram-bot init ~/botconfigs/myproj/mybot.json # or a custom filename
132
+ claude-telegram-bot init ~/botconfigs/myproj # writes ~/botconfigs/myproj/mybot.json
133
+ claude-telegram-bot init ~/botconfigs/myproj/myapp.json # or a custom filename
135
134
  # edit the config (token, projectDir, …)
136
135
  claude-telegram-bot ~/botconfigs/myproj/mybot.json
137
136
  ```
@@ -152,7 +151,7 @@ Run several projects/personas by making one config file each and passing its pat
152
151
  leave `allowedChatId` empty for now.
153
152
 
154
153
  **2) Find your chatId and lock the bot to it** — Start the bot (`claude-telegram-bot …`), send it any
155
- message in Telegram; it replies with this chat's `chatId`. Put that number into `config.json`
154
+ message in Telegram; it replies with this chat's `chatId`. Put that number into `mybot.json`
156
155
  `allowedChatId` and restart. Now only you can use it. (See [Security](#security) — this is your only
157
156
  auth layer.)
158
157
 
@@ -175,18 +174,18 @@ Commands: `/new` (reset context / new session) · `/stop` (stop current task; `-
175
174
 
176
175
  **4) Keep it always on (optional)** — see [Always-on with launchd](#always-on-with-launchd-macos).
177
176
 
178
- > **From source** (for hacking on the bot): clone the repo, `cp config.example.json config.json`,
179
- > then `node bot.mjs [config.json]`. Same behavior as the CLI.
177
+ > **From source** (for hacking on the bot): clone the repo, `cp config.example.json mybot.json`,
178
+ > then `node bot.mjs [mybot.json]`. Same behavior as the CLI.
180
179
 
181
180
  ---
182
181
 
183
182
  ## Configuration
184
183
 
185
184
  ```sh
186
- cp config.example.json config.json
185
+ cp config.example.json mybot.json
187
186
  ```
188
187
 
189
- Edit `config.json`:
188
+ Edit `mybot.json`:
190
189
 
191
190
  | Key | Description |
192
191
  |---|---|
@@ -273,7 +272,7 @@ Config-defined jobs still require a restart to change; only chat-added jobs are
273
272
 
274
273
  The code is project-agnostic: make **one config file per project** and run several at once.
275
274
 
276
- - Run: `node bot.mjs /absolute/path/to/project.config.json` (no arg → `./config.json`)
275
+ - Run: `node bot.mjs /absolute/path/to/project.config.json` (no arg → `./mybot.json`, fallback `./config.json`)
277
276
  - `state.json` and `attachments/` live in the **config file's folder**, so projects don't mix.
278
277
  - **Note**: Telegram allows only one poller per token → each project needs its **own BotFather
279
278
  token**.
@@ -299,7 +298,7 @@ One codebase, **a separate config file per role**.
299
298
  shell-using bot (`bypassPermissions`) to **just one** to avoid concurrent-edit conflicts. For
300
299
  read/plan-only, use `plan`.
301
300
  - **Session isolation**: the `state` filename is derived from the config name
302
- (`config.json` → `state.json`, `dev.config.json` → `dev.config.state.json`), so multiple configs
301
+ (`mybot.json` → `mybot.state.json`, `dev.config.json` → `dev.config.state.json`), so multiple configs
303
302
  in one folder don't share context.
304
303
  - **One token per bot**: each bot needs its own BotFather token (`allowedChatId` can be the same).
305
304
 
package/bot.mjs CHANGED
@@ -58,7 +58,7 @@ Requires: the claude CLI installed and authenticated on the host.`);
58
58
  }
59
59
  if (a === "init") {
60
60
  const arg = process.argv[3];
61
- const target = arg?.endsWith(".json") ? resolve(arg) : join(arg || process.cwd(), "config.json");
61
+ const target = arg?.endsWith(".json") ? resolve(arg) : join(arg || process.cwd(), "mybot.json");
62
62
  if (existsSync(target)) {
63
63
  console.error(`Already exists: ${target}`);
64
64
  process.exit(1);
@@ -71,8 +71,9 @@ Requires: the claude CLI installed and authenticated on the host.`);
71
71
 
72
72
  // Config path via arg or BOT_CONFIG env so one shared codebase can drive many
73
73
  // projects; state + attachments live next to that config, keeping projects
74
- // isolated. Falls back to ./config.json for the single-project setup.
75
- const CONFIG_PATH = process.argv[2] || process.env.BOT_CONFIG || join(HERE, "config.json");
74
+ // isolated. Defaults to mybot.json, falls back to config.json for existing setups.
75
+ const _defaultCfg = existsSync(join(HERE, "mybot.json")) ? join(HERE, "mybot.json") : join(HERE, "config.json");
76
+ const CONFIG_PATH = process.argv[2] || process.env.BOT_CONFIG || _defaultCfg;
76
77
  const DATA_DIR = dirname(CONFIG_PATH);
77
78
  // 데이터(state·attachments)는 config 폴더 아래 숨김 폴더 .claude-bot/ 에 모은다.
78
79
  // state 파일명은 config 이름에서 파생 → 여러 페르소나 config 가 한 .claude-bot/ 를 공유해도 안 섞임
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-telegram-bot",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Drive Claude Code from Telegram — messages run headless `claude -p` in a project dir and replies come back to the chat. Zero dependencies.",
5
5
  "type": "module",
6
6
  "bin": {