chatccc 0.1.3 → 0.1.4
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.md +11 -1
- package/bin/chatccc.mjs +14 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,12 +34,22 @@ ChatCCC 把 Claude Code 接入了飞书群聊:
|
|
|
34
34
|
npm install -g chatccc
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
要求 Node.js >= 20
|
|
37
|
+
要求 Node.js >= 20。安装完成后,**先进入你的项目根目录**(该目录里应有 `src/`、`.env`,可参照 `.env.example` 创建 `.env`),再启动:
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
+
cd /path/to/your/project # Windows 示例: cd D:\code\ChatCCC
|
|
40
41
|
chatccc
|
|
41
42
|
```
|
|
42
43
|
|
|
44
|
+
所有相对路径(`.env`、`src/index.ts`)都相对**当前终端所在目录**。若在用户主目录(如 `C:\Users\1`)执行,会出现 `.env: not found` 或找不到 `src/index.ts`。
|
|
45
|
+
|
|
46
|
+
若不用全局命令、改用 tsx 直接跑,同样要在项目根目录执行:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
cd /path/to/your/project
|
|
50
|
+
npx tsx --env-file=.env src/index.ts
|
|
51
|
+
```
|
|
52
|
+
|
|
43
53
|
#### 从源码安装
|
|
44
54
|
|
|
45
55
|
```bash
|
package/bin/chatccc.mjs
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
4
6
|
|
|
5
|
-
const pkgRoot = new URL("../", import.meta.url);
|
|
6
|
-
// 勿用 pathToFileURL("./"):会相对于进程 cwd。用 createRequire 从本脚本所在包解析 tsx
|
|
7
7
|
const require = createRequire(import.meta.url);
|
|
8
|
-
|
|
8
|
+
const pkgRoot = dirname(fileURLToPath(new URL("..", import.meta.url)));
|
|
9
|
+
const indexTs = join(pkgRoot, "src", "index.ts");
|
|
10
|
+
const tsxCli = require.resolve("tsx/cli");
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
const result = spawnSync(
|
|
13
|
+
process.execPath,
|
|
14
|
+
[tsxCli, indexTs, ...process.argv.slice(2)],
|
|
15
|
+
{ stdio: "inherit", cwd: process.cwd(), env: process.env }
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
process.exit(result.status === null ? 1 : result.status);
|